From 0d13a8e22cfd29bcb4360f2f5d6ed0c2e38e1052 Mon Sep 17 00:00:00 2001
From: Benson <benson@pollex.com>
Date: 星期四, 30 十二月 2021 18:20:51 +0800
Subject: [PATCH] Merge branch 'Phase2'

---
 PAMapp/shared/services/my-consultant.service.ts |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/PAMapp/shared/services/my-consultant.service.ts b/PAMapp/shared/services/my-consultant.service.ts
index 1b97fed..c48821a 100644
--- a/PAMapp/shared/services/my-consultant.service.ts
+++ b/PAMapp/shared/services/my-consultant.service.ts
@@ -1,8 +1,7 @@
 import { http } from "./httpClient";
-
 import { AgentInfo } from '~/shared/models/agent-info.model';
 import { Consultant } from "../models/consultant.model";
-
+import _ from "lodash";
 class MyConsultantService {
 
   async getFavoriteConsultantList(): Promise<Consultant[]> {
@@ -24,6 +23,31 @@
     return http.get('/consultant/detail', {params:{agentNo:agentNo}}).then((res) => res.data);
   }
 
+  // 蝘駁憿批��
+  async deleteConsultant(agentId: string) {
+    return http.delete(`/consultant/favorite/${agentId}`);
+  }
+
+  // 璅�撌脰蝯�
+  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}`);
+  }
+
+  // ���“�����
+  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();

--
Gitblit v1.8.0