From 04bc0c7e0606d7d29f5284df07e60a67b3dd883b Mon Sep 17 00:00:00 2001 From: wayne <wayne8692wayne8692@gmail.com> Date: 星期一, 13 十二月 2021 12:08:22 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- PAMapp/store/index.ts | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/PAMapp/store/index.ts b/PAMapp/store/index.ts index 7b8173f..b26be7e 100644 --- a/PAMapp/store/index.ts +++ b/PAMapp/store/index.ts @@ -16,6 +16,10 @@ myAppointmentReviewLogList: AppointmentLog[] = []; + get isUserLogin() { + return this.context.getters['localStorage/isUserLogin']; + } + @Mutation updateRecommend(data: Consultant[]) { this.recommendList = data; } @@ -45,7 +49,8 @@ @Action async storeConsultantList() { const localData = getFavoriteFromStorage(); - if (this.context.getters['localStorage/currentRole'] !== Role.USER) { + + if (!this.isUserLogin) { this.context.commit('updateConsultantList', localData) return; }; @@ -70,7 +75,7 @@ // no agent was removed if (left.length === this.myConsultantList.length) return false; - if (this.context.getters['localStorage/currentRole'] !== Role.USER) { + if (!this.isUserLogin) { setFavoriteToStorage(left); } else { await deleteConsultant(agentNo) @@ -87,8 +92,7 @@ const found = this.myConsultantList.find(item => item.agentNo === consultantToAdd.agentNo); if (!found) { const newData = [consultantToAdd].concat(this.myConsultantList); - - if (this.context.getters['localStorage/currentRole'] === Role.USER) { + if (this.isUserLogin) { await addFavoriteConsultant([consultantToAdd.agentNo]) } else { setFavoriteToStorage(newData); -- Gitblit v1.8.0