保誠-保戶業務員媒合平台
Tomas
2023-08-05 93d8ea605204e75598b2b5bc62ea9587b7ab7d25
PAMapp/shared/services/my-consultant.service.ts
@@ -1,8 +1,9 @@
import _ from "lodash";
import { http } from "./httpClient";
import { AgentInfo } from '~/shared/models/agent-info.model';
import { Consultant } from "../models/consultant.model";
import _ from "lodash";
import { ClientInfo } from "../models/client.model";
import { Appointment } from "../models/appointment.model";
class MyConsultantService {
  async getFavoriteConsultantList(): Promise<Consultant[]> {
@@ -13,6 +14,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 {
@@ -30,10 +35,22 @@
  }
  // 標記為已聯絡
  markAsContact(appointmentId: number): Promise<ClientInfo> {
    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' })