From 76c1ce3c2eb001560bfb785f7b2f62d4ec64dcb6 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期五, 10 十二月 2021 09:49:50 +0800
Subject: [PATCH] update 使用 currentRole 判斷目前是否為顧問/客戶登入狀態

---
 PAMapp/components/Consultant/ConsultantCard.vue |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue
index b983b50..2e7937e 100644
--- a/PAMapp/components/Consultant/ConsultantCard.vue
+++ b/PAMapp/components/Consultant/ConsultantCard.vue
@@ -122,13 +122,13 @@
 </template>
 
 <script lang="ts">
-import { Vue, Component, Prop, Action } from 'nuxt-property-decorator';
+import { Vue, Component, Prop, Action, namespace } from 'nuxt-property-decorator';
 import { getAppointmentDetail, UserReviewsConsultantsParams, userReviewsConsultants, cancelAppointment } from '~/assets/ts/api/consultant';
 import { Consultant, Appointment } from '~/assets/ts/models/consultant.model';
-import { isLogin } from '~/assets/ts/auth';
 import { isMobileDevice } from '~/assets/ts/device';
+import { Role } from '~/assets/ts/models/enum/Role';
 
-
+const roleStorage = namespace('localStorage');
 @Component({
     filters: {
         formatNumber(index: number) {
@@ -152,6 +152,8 @@
     @Action removeFromMyConsultantList!: (agentNo: string) => Promise<boolean>;
     @Action storeConsultantList!: any;
     @Prop() agentInfo!: Consultant;
+    @roleStorage.Getter currentRole!:string;
+
     isVisibleDialog = false;
     reviewsBtn = false;
     status = false;
@@ -246,7 +248,7 @@
     reserveCommunication() {
         const contactStatus = this.agentInfo.contactStatus;
         if (!contactStatus || contactStatus === 'picked') {
-            isLogin()
+            this.currentRole === Role.USER
                 ? this.$router.push(`/questionnaire/${this.agentInfo.agentNo}`)
                 : this.$router.push('/login');
         } else {

--
Gitblit v1.8.0