From 724f4c529a8ee3fa0a4f24d0fe55f79b70181a25 Mon Sep 17 00:00:00 2001 From: Tomas <tomasysh@gmail.com> Date: 星期三, 22 十二月 2021 16:06:55 +0800 Subject: [PATCH] add: auth.service --- PAMapp/pages/questionnaire/_agentNo.vue | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/PAMapp/pages/questionnaire/_agentNo.vue b/PAMapp/pages/questionnaire/_agentNo.vue index 83f35e9..69ea619 100644 --- a/PAMapp/pages/questionnaire/_agentNo.vue +++ b/PAMapp/pages/questionnaire/_agentNo.vue @@ -143,8 +143,9 @@ import { getRequestsFromStorage, removeRequestQuestionFromStorage, setRequestsToStorage } from '~/shared/storageRequests'; import _ from 'lodash'; -import queryConsultantService from '~/shared/services/query-consultant.service'; import appointmentService from '~/shared/services/appointment.service'; +import authService from '~/shared/services/auth.service'; +import queryConsultantService from '~/shared/services/query-consultant.service'; import { Consultant } from '~/shared/models/consultant.model'; import { ContactType } from '~/shared/models/enum/ContactType'; import { Gender } from '~/shared/models/enum/Gender'; @@ -280,7 +281,7 @@ beforeRouteEnter(to: any, from: any, next: any) { next(vm => { - const isUserLogin = vm.$store.getters['localStorage/isUserLogin']; + const isUserLogin = authService.isUserLogin(); if (from.name === 'login' && !isUserLogin) { vm.$router.go(-1); return; @@ -293,7 +294,7 @@ } async fetch() { - if (this.isUserLogin) { + if (authService.isUserLogin()) { await this.storeConsultantList(); }; } @@ -451,7 +452,7 @@ : appointmentInfo.appointmentDate; } @Watch('myConsultantList') onMyConsultantListChange() { - if (this.isUserLogin && this.myConsultantList.length > 0) { + if (authService.isUserLogin() && this.myConsultantList.length > 0) { const editAppointment = this.getLatestReserved(this.$route.params.agentNo); if (editAppointment && editAppointment.agentNo) { -- Gitblit v1.8.0