保誠-保戶業務員媒合平台
Mila
2022-01-22 c047a3336ff1efc7d21edee6f0c8811264eebae7
PAMapp/store/index.ts
@@ -7,6 +7,7 @@
import { getFavoriteFromStorage, setFavoriteToStorage } from '~/shared/storageConsultant';
import { AppointmentLog } from '~/shared/models/appointment.model';
import { AgentOfStrictQuery, StrictQueryParams } from '~/shared/models/strict-query.model';
import { NotificationList } from '~/shared/models/reviews.model';
@Module
export default class Store extends VuexModule {
@@ -14,7 +15,9 @@
    strictQueryList: AgentOfStrictQuery[] = [];
    myConsultantList: Consultant[] = [];
    myAppointmentReviewLogList: AppointmentLog[] = [];
    reviewLogList: AppointmentLog[] = [];
    unReviewLogList: AppointmentLog[] = [];
    notificationList: NotificationList[] = [];
    get isUserLogin() {
        return this.context.getters['localStorage/isUserLogin'];
@@ -36,8 +39,18 @@
    }
    @Mutation
    updateMyAppointmentReviewLog(data: AppointmentLog[]) {
        this.myAppointmentReviewLogList = data;
    updateReviewLog(data: AppointmentLog[]) {
        this.reviewLogList = data;
    }
    @Mutation
    updateUnReviewLog(data: AppointmentLog[]) {
        this.unReviewLogList = data;
    }
    @Mutation
    updateNotification(data: NotificationList[]) {
        this.notificationList = data;
    }
    @Action
@@ -118,7 +131,10 @@
                }
            });
            const sortedData = dataWithLatestDate.sort((a, b) => +b.compareDate - +a.compareDate);
            this.context.commit('updateMyAppointmentReviewLog', sortedData);
            const reviewLog = sortedData.filter(item => item.score);
            const unReviewLog = sortedData.filter(item => !item.score);
            this.context.commit('updateReviewLog', reviewLog);
            this.context.commit('updateUnReviewLog', unReviewLog);
        });
    }
@@ -131,4 +147,11 @@
        });
    }
    @Action
    storeMyPersonalNotification() {
        reviewsService.getMyPersonalNotification().then(data => {
            this.context.commit('updateNotification', data);
        })
    }
}