| | |
| | | |
| | | @Action |
| | | async addToMyConsultantList(consultantToAdd: Consultant) { |
| | | if (consultantToAdd) { |
| | | const found = this.myConsultantList.find(item => item.agentNo === consultantToAdd.agentNo); |
| | | if (!found) { |
| | | const newData = [consultantToAdd].concat(this.myConsultantList); |
| | | if (this.isUserLogin) { |
| | | await queryConsultantService.addFavoriteConsultant([{ agentNo: consultantToAdd.agentNo, createdTime: consultantToAdd.updateTime }]) |
| | | } else { |
| | | setFavoriteToStorage(newData); |
| | | } |
| | | if (consultantToAdd) { |
| | | const found = this.myConsultantList.find(item => item.agentNo === consultantToAdd.agentNo); |
| | | if (!found) { |
| | | const newData = [consultantToAdd].concat(this.myConsultantList); |
| | | |
| | | this.context.commit('updateConsultantList', newData) |
| | | |
| | | return true; |
| | | if (this.isUserLogin) { |
| | | try { |
| | | const response = await queryConsultantService.addFavoriteConsultant([{ agentNo: consultantToAdd.agentNo, createdTime: consultantToAdd.updateTime }]); |
| | | if (response !== null) { |
| | | this.context.commit('updateConsultantList', newData); |
| | | return true; |
| | | } else { |
| | | throw new Error('queryConsultantService.addFavoriteConsultant returned null-like value.'); |
| | | } |
| | | } catch (error) { |
| | | console.error('An error occurred while adding favorite consultant:', error); |
| | | throw error; |
| | | } |
| | | } else { |
| | | setFavoriteToStorage(newData); |
| | | this.context.commit('updateConsultantList', newData); |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | @Action |
| | | storeMyAppointmentReviewLog() { |
| | | reviewsService.getMyReviewLog().then((data) => { |