From 37b34839e943bc619b7ee502886dd78b8927c1ea Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期二, 08 二月 2022 14:05:55 +0800
Subject: [PATCH] update: [帳號設定] update userInfo  store mechanism

---
 PAMapp/pages/login/index.vue |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/PAMapp/pages/login/index.vue b/PAMapp/pages/login/index.vue
index 64a188b..7ae3d1e 100644
--- a/PAMapp/pages/login/index.vue
+++ b/PAMapp/pages/login/index.vue
@@ -355,6 +355,9 @@
   @roleStorage.Mutation
   storageRole!: (role:string) => void;
 
+  @roleStorage.Mutation
+  storageUserInfo!: (userInfo: RegisterInfo) => void;
+
   @Ref('contract') readonly contract!: any;
 
   connectDevice: 'MOBILE' | 'EMAIL' = 'MOBILE';
@@ -452,7 +455,7 @@
       this.storageRole(Role.USER);
       this.phoneSuccessConfirmVisable = true;
       this.autoRedirect();
-      this.storagePhoneOrEmail(this.setRegisterInfo());
+      this.storageUserInfo(this.setRegisterInfo());
     }).catch(error => {
       this.checkHttpErrorStatus(error);
     });
@@ -476,7 +479,7 @@
     loginService.register(registerInfo).then(res => {
       this.storageIdToken(res.id_token);
       this.storageRole(Role.USER);
-      this.storagePhoneOrEmail(registerInfo);
+      this.storageUserInfo(this.setRegisterInfo());
       this.autoRedirect();
       this.registerSuccessConfirmVisable = true;
     }).catch(() => {
@@ -632,11 +635,6 @@
           messageBoxService.showErrorMessage('',error);
           break;
       }
-  }
-
-  private storagePhoneOrEmail(registerInfo:RegisterInfo):void{
-    const info = {...registerInfo, time: new Date()}
-    localStorage.setItem('userInfo',JSON.stringify(info));
   }
 
   private removeOtpTime() {

--
Gitblit v1.8.0