保誠-保戶業務員媒合平台
HelenHuang
2022-03-31 c5219a512b54562182c66d4501b258fb94d38e32
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)
@@ -160,7 +167,8 @@
          break;
        default:
          messageBoxService.showErrorMessage('',error);
          const defaultErrorMsg = error.response.data.title
          messageBoxService.showErrorMessage('',defaultErrorMsg);
          break;
      }
    }