From d56d1b2b76e5639006c5ce8aaedb5979e74fab70 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期三, 09 二月 2022 16:24:29 +0800
Subject: [PATCH] clean code

---
 PAMapp/pages/login/index.vue |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/PAMapp/pages/login/index.vue b/PAMapp/pages/login/index.vue
index 7ae3d1e..2aacaec 100644
--- a/PAMapp/pages/login/index.vue
+++ b/PAMapp/pages/login/index.vue
@@ -399,7 +399,6 @@
 
   beforeRouteEnter (to, from, next) {
       next(vm => {
-        console.log(from.path, 'beforeRouteEnter');
         vm.previousPath = from.path;
       })
   }
@@ -455,7 +454,7 @@
       this.storageRole(Role.USER);
       this.phoneSuccessConfirmVisable = true;
       this.autoRedirect();
-      this.storageUserInfo(this.setRegisterInfo());
+      this.storagePhoneOrEmail(this.setRegisterInfo());
     }).catch(error => {
       this.checkHttpErrorStatus(error);
     });
@@ -479,7 +478,7 @@
     loginService.register(registerInfo).then(res => {
       this.storageIdToken(res.id_token);
       this.storageRole(Role.USER);
-      this.storageUserInfo(this.setRegisterInfo());
+      this.storagePhoneOrEmail(registerInfo);
       this.autoRedirect();
       this.registerSuccessConfirmVisable = true;
     }).catch(() => {
@@ -501,7 +500,6 @@
   private redirect() {
     const backToPrevious = ['questionnaire', 'myConsultantList'];
     const find = backToPrevious.findIndex(item => this.previousPath.includes(item));
-    console.log(this.previousPath, find, 'redirect');
     find > -1 ? this.$router.go(-1) : this.$router.push('/');
   }
 
@@ -637,6 +635,13 @@
       }
   }
 
+  private storagePhoneOrEmail(registerInfo:RegisterInfo):void{
+    const info = {...registerInfo, time: new Date()}
+  // storageUserInfo!: (userInfo: RegisterInfo) => void;
+    this.storageUserInfo(info);
+    // localStorage.setItem('userInfo',JSON.stringify(info));
+  }
+
   private removeOtpTime() {
     otpService.removeOtpTimeToStorage(OtpStorageName.PHONE);
     otpService.removeOtpTimeToStorage(OtpStorageName.EMAIL);

--
Gitblit v1.8.0