From 2eea9fe0eac0dd2edb717591f372d160296bed0f Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期三, 19 一月 2022 16:09:47 +0800
Subject: [PATCH] update: 顧問-登入後將顧問細節設定到 store, 供預約單的發送約訪通知時使用

---
 PAMapp/pages/consultantLogin/index.vue |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/PAMapp/pages/consultantLogin/index.vue b/PAMapp/pages/consultantLogin/index.vue
index 2358123..dcebb79 100644
--- a/PAMapp/pages/consultantLogin/index.vue
+++ b/PAMapp/pages/consultantLogin/index.vue
@@ -61,8 +61,11 @@
   import { Role } from '~/shared/models/enum/Role';
   import messageBoxService from '~/shared/services/message-box.service';
   import loginService from '~/shared/services/login.service'
+import { AgentInfo } from '~/shared/models/agent-info.model';
 
+  const loginStore  = namespace('login.store');
   const roleStorage = namespace('localStorage');
+
   @Component({
     layout: 'home'
   })
@@ -75,6 +78,9 @@
 
     @roleStorage.Mutation
     storageConsultantId!:(id:string) => void;
+
+    @loginStore.Action
+    getLoginConsultantDetail!: (agentNo: string) => Promise<AgentInfo>;
 
     consultantDto = {
       password: '',
@@ -130,7 +136,7 @@
     private verify():void{
       loginService.getVerificationStatus(this.verificationCode).then( verifySuccess => {
         if(verifySuccess.data){
-          this.loginWithConsultant()
+          this.loginWithConsultant();
         }else{
           this.clearValue();
           this.regenerateImgOfVerification();
@@ -141,6 +147,7 @@
 
     private loginWithConsultant(): void {
       loginService.logInToConsultant(this.consultantDto).then(res => {
+        this.getLoginConsultantDetail(this.consultantDto.username);
         this.storageIdToken(res.data.id_token);
         this.storageRole(Role.ADMIN);
         this.storageConsultantId(this.consultantDto.username)

--
Gitblit v1.8.0