From c5219a512b54562182c66d4501b258fb94d38e32 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 31 三月 2022 10:55:53 +0800 Subject: [PATCH] Update: 預設錯誤訊息改從title取 --- PAMapp/pages/login/index.vue | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/PAMapp/pages/login/index.vue b/PAMapp/pages/login/index.vue index 7ae3d1e..47c0b38 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('/'); } @@ -632,11 +630,19 @@ }, 1000); break; default: - messageBoxService.showErrorMessage('',error); + const defaultErrorMsg = OtpErrorCode[error.response?.data?.title] + messageBoxService.showErrorMessage('',defaultErrorMsg); break; } } + 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