| | |
| | | |
| | | myAppointmentReviewLogList: AppointmentLog[] = []; |
| | | |
| | | get isUserLogin() { |
| | | return this.context.getters['localStorage/isUserLogin']; |
| | | } |
| | | |
| | | @Mutation updateRecommend(data: Consultant[]) { |
| | | this.recommendList = data; |
| | | } |
| | |
| | | @Action |
| | | async storeConsultantList() { |
| | | const localData = getFavoriteFromStorage(); |
| | | if (this.context.getters['localStorage/currentRole'] !== Role.USER) { |
| | | |
| | | if (!this.isUserLogin) { |
| | | this.context.commit('updateConsultantList', localData) |
| | | return; |
| | | }; |
| | |
| | | // 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) |
| | |
| | | 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); |