import { http } from "./httpClient";
|
|
import { AgentInfo } from '~/shared/models/agent-info.model';
|
import { Consultant } from "../models/consultant.model";
|
|
class MyConsultantService {
|
|
async getFavoriteConsultantList(): Promise<Consultant[]> {
|
return http.get<Consultant[]>('/consultant/favorite').then((res) => {
|
const hasNewConsultant = res.data.find((consultant) => !consultant.customerViewTime);
|
if (hasNewConsultant) {
|
this.viewMyConsultantList();
|
};
|
return res.data;
|
});
|
}
|
|
private viewMyConsultantList(): void {
|
http.post('/consultant/favorite/view');
|
}
|
|
//顧問詳細資訊
|
async getConsultantDetail(agentNo:string): Promise<AgentInfo> {
|
return http.get('/consultant/detail', {params:{agentNo:agentNo}}).then((res) => res.data);
|
}
|
|
// 移除顧問
|
async deleteConsultant(agentId: string) {
|
return http.delete(`/consultant/favorite/${agentId}`);
|
}
|
|
}
|
|
export default new MyConsultantService();
|