| | |
| | | import { http } from "./httpClient"; |
| | | import _ from "lodash"; |
| | | |
| | | import { http } from "./httpClient"; |
| | | import { AgentInfo } from '~/shared/models/agent-info.model'; |
| | | import { Consultant } from "../models/consultant.model"; |
| | | |
| | | import { Appointment } from "../models/appointment.model"; |
| | | class MyConsultantService { |
| | | |
| | | async getFavoriteConsultantList(): Promise<Consultant[]> { |
| | |
| | | } |
| | | |
| | | // 標記為已聯絡 |
| | | 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}`); |
| | | markAsContact(appointmentId: number): Promise<Appointment> { |
| | | return http.post(`/appointment/markAsContacted/${appointmentId}`).then(res => res.data); |
| | | } |
| | | |
| | | // 取得顧問頭像 |
| | | getConsultantAvatar(agentNo:string):Promise<string>{ |
| | | return http.get(`/consultant/avatar/${agentNo}`,{ responseType : 'arraybuffer' }) |
| | | .then( response => { |
| | | const toBase64 = window.btoa( |
| | | _.reduce( new Uint8Array(response.data),(data,byte) => |
| | | data + String.fromCharCode(byte),'') |
| | | ); |
| | | const imgSrc = `data:image/png;base64,${toBase64}`; |
| | | return imgSrc; |
| | | }); |
| | | } |
| | | } |
| | | |
| | | export default new MyConsultantService(); |