refactor: separate api/appointment.ts into several services
| | |
| | | import { isMobileDevice } from '~/shared/device'; |
| | | import { hideReviews } from '~/shared/const/hide-reviews'; |
| | | import { ClientInfo } from '~/shared/models/client.model'; |
| | | import myConsultantService from '~/shared/services/my-consultant.service'; |
| | | |
| | | |
| | | @Component({ |
| | |
| | | } |
| | | |
| | | markAppointment() { |
| | | appointmentService.markAsContact(this.client.id).then(data => { |
| | | myConsultantService.markAsContact(this.client.id).then(data => { |
| | | // TODO: è¦æ¥å¾å°å³åç updated client è³æ - Ben 2021/11/16 |
| | | const updatedClient = {...this.client}; |
| | | updatedClient.communicateStatus = 'contacted'; |
| | |
| | | }); |
| | | } |
| | | |
| | | // é¡§åç»å
¥é¡¯ç¤ºæ°é ç´å®çæ¸å¾è§¸ç¼ |
| | | private viewAllAppointment(): void { |
| | | http.post('/consultant/record/allAppointmentsView').then(); |
| | | } |
| | | |
| | | // æ¨è¨çºå·²è¯çµ¡ |
| | | markAsContact(appointmentId: number): Promise<void> { |
| | | // TODO: è·å¾ç«¯ç¢ºèªï¼é裡ç API ä¸æè©²å³å void, èæ¯æè©²æ¯æ´æ°å¾çè³æ - Ben 2021/11/16 |
| | | // return http.post('/appointment/markAsContacted/'+appointmentId, undefined, {headers}) |
| | | // .then(res => res.data) |
| | | return http.post(`/appointment/markAsContacted/${appointmentId}`); |
| | | } |
| | | |
| | | // è®åé ç´å®æè§¸ç¼ï¼ç´éè®åé ç´å®æé |
| | |
| | | return http.delete(`/consultant/favorite/${agentId}`); |
| | | } |
| | | |
| | | // æ¨è¨çºå·²è¯çµ¡ |
| | | markAsContact(appointmentId: number): Promise<void> { |
| | | // TODO: è·å¾ç«¯ç¢ºèªï¼é裡ç API ä¸æè©²å³å void, èæ¯æè©²æ¯æ´æ°å¾çè³æ - Ben 2021/11/16 |
| | | // return http.post('/appointment/markAsContacted/'+appointmentId, undefined, {headers}) |
| | | // .then(res => res.data) |
| | | return http.post(`/appointment/markAsContacted/${appointmentId}`); |
| | | } |
| | | |
| | | } |
| | | |
| | | export default new MyConsultantService(); |
| | |
| | | import { http } from "./httpClient"; |
| | | |
| | | import { UserReviewsConsultantsParams } from "../models/reviews.model"; |
| | | import { AppointmentLog } from "../models/appointment.model"; |
| | | |
| | | class ReviewsService { |
| | | |
| | |
| | | userReviewsConsultants(data: UserReviewsConsultantsParams) { |
| | | return http.post('/satisfaction/create', data ); |
| | | } |
| | | //å徿æè©åç´é |
| | | async getMyReviewLog(): Promise<AppointmentLog[]> { |
| | | return http.get('/satisfaction/getMySatisfaction').then(res => res.data); |
| | | } |
| | | } |
| | | |
| | | export default new ReviewsService(); |
| | |
| | | import { StrictQueryParams } from '~/shared/models/strict-query.model'; |
| | | import { Module, VuexModule, Mutation, Action } from 'vuex-module-decorators' |
| | | |
| | | import { getMyReviewLog } from '~/shared/api/appointment'; |
| | | import { getFavoriteFromStorage, setFavoriteToStorage } from '~/shared/storageConsultant'; |
| | | |
| | | import myConsultantService from '~/shared/services/my-consultant.service'; |
| | | import queryConsultantService from '~/shared/services/query-consultant.service'; |
| | | import appointmentService from '~/shared/services/appointment.service'; |
| | | import reviewsService from '~/shared/services/reviews.service'; |
| | | |
| | | import { Consultant } from '~/shared/models/consultant.model'; |
| | | import { AppointmentLog } from '~/shared/models/appointment.model'; |
| | |
| | | |
| | | @Action |
| | | storeMyAppointmentReviewLog() { |
| | | getMyReviewLog().then((data) => { |
| | | reviewsService.getMyReviewLog().then((data) => { |
| | | const dataWithLatestDate = data.map((item) => { |
| | | return { |
| | | ...item, |