保誠-保戶業務員媒合平台
wayne
2021-12-13 04bc0c7e0606d7d29f5284df07e60a67b3dd883b
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);