From 75e7047b4f121f39a39e4fa74449a2366f15310b Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期六, 05 八月 2023 16:56:33 +0800
Subject: [PATCH] Fixed: [弱掃] p10.1 Bad use of null-like value

---
 PAMapp/shared/services/appointment.service.ts |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/PAMapp/shared/services/appointment.service.ts b/PAMapp/shared/services/appointment.service.ts
index e56a270..71ef69d 100644
--- a/PAMapp/shared/services/appointment.service.ts
+++ b/PAMapp/shared/services/appointment.service.ts
@@ -87,11 +87,27 @@
     return http.delete(`/appointment/memo/${appointmentMemoId}`)
   }
 
-  // ���蝯��, ��蝯��敦
+  /**
+   * ���蝯��, ��蝯��敦
+   * @param appointmentInfo ��蝯������隞�
+   * @returns ��蝯����
+   */
   async closeAppointment(appointmentInfo: ToDoneAppointment | ToCloseAppointment) {
-    return http.post(`/appointment/close`, appointmentInfo).then((res) => res.data);
+    try {
+      const response = await http.post(`/appointment/close`, appointmentInfo);
+      if (response !== null) {
+        return response.data;
+      } else {
+        throw new Error('http.post returned null-like value.');
+      }
+    } catch (error) {
+      // �隞亙甇方���隤斗����身��
+      console.error('An error occurred while closing appointment:', error);
+      throw error;
+    }
   }
 
+
   // 蝝赤� API
   async informAppointment(appointmentInformation: ToInformAppointment) {
     return http.post(`/notice/send`, appointmentInformation).then((res) => res.data);

--
Gitblit v1.8.0