From 93d8ea605204e75598b2b5bc62ea9587b7ab7d25 Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期六, 05 八月 2023 18:21:11 +0800
Subject: [PATCH] Fixed: [弱掃] p22.1 Bad use of null-like value

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

diff --git a/PAMapp/shared/services/my-consultant.service.ts b/PAMapp/shared/services/my-consultant.service.ts
index b107a8e..8219eb0 100644
--- a/PAMapp/shared/services/my-consultant.service.ts
+++ b/PAMapp/shared/services/my-consultant.service.ts
@@ -35,10 +35,22 @@
   }
 
   // 璅�撌脰蝯�
-  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' })

--
Gitblit v1.8.0