From f316bd2d97efb54ef48fde17b4e38fba2fc7b1aa Mon Sep 17 00:00:00 2001 From: Tomas <tomasysh@gmail.com> Date: 星期四, 11 一月 2024 17:17:01 +0800 Subject: [PATCH] project: remove lodash library --- PAMapp/shared/services/my-consultant.service.ts | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-) diff --git a/PAMapp/shared/services/my-consultant.service.ts b/PAMapp/shared/services/my-consultant.service.ts index 3d4dd78..5356979 100644 --- a/PAMapp/shared/services/my-consultant.service.ts +++ b/PAMapp/shared/services/my-consultant.service.ts @@ -1,9 +1,8 @@ -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"; +import { Consultant } from "../models/consultant.model"; +import { http } from "./httpClient"; class MyConsultantService { async getFavoriteConsultantList(): Promise<Consultant[]> { @@ -14,6 +13,10 @@ }; return res.data; }); + } + + async getAllGroupByConsultant(): Promise<Consultant[]> { + return http.get<Consultant[]>('/appointment/customer/get_all_group_by_consultant').then((res) => res.data); } private viewMyConsultantList(): void { @@ -31,17 +34,29 @@ } // 璅�撌脰蝯� - markAsContact(appointmentId: number): Promise<Appointment> { - return http.post(`/appointment/markAsContacted/${appointmentId}`).then(res => res.data); + async markAsContact(appointmentId: number): Promise<Appointment> { + try { + const response = await http.post(`/appointment/markAsContacted/${appointmentId}`); + if (response !== null) { + return response.data; + } else { + throw new Error('http.post returned null-like value.'); + } + } catch (error) { + console.error('An error occurred while marking appointment as contacted:', error); + // �隞亙甇方���隤斗����身�� + throw error; + } } + // ���“����� 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),'') + Array.from(new Uint8Array(response.data)).reduce((data, byte) => + data + String.fromCharCode(byte), '') ); const imgSrc = `data:image/png;base64,${toBase64}`; return imgSrc; -- Gitblit v1.8.0