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

---
 PAMapp/shared/services/appointment.service.ts |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/PAMapp/shared/services/appointment.service.ts b/PAMapp/shared/services/appointment.service.ts
index 71ef69d..2f13c2b 100644
--- a/PAMapp/shared/services/appointment.service.ts
+++ b/PAMapp/shared/services/appointment.service.ts
@@ -16,8 +16,17 @@
   }
 
   // 憿批��汗�撌望������蝝���孛�API
-  private viewAllAppointment(): void {
-    http.post('/consultant/record/allAppointmentsView').then();
+  private async viewAllAppointment(): Promise<void> {
+    try {
+      const response = await http.post('/consultant/record/allAppointmentsView');
+      if (response !== null) {
+      } else {
+        throw new Error('http.post returned null-like value.');
+      }
+    } catch (error) {
+      console.error('An error occurred while viewing all appointments:', error);
+      throw error;
+    }
   }
 
   // 霈�������孛�嚗������������
@@ -115,7 +124,18 @@
 
   // �憓�赤閮��
   async createInterviewRecord(interviewRecordInfo: InterviewRecordInfo) {
-    return http.post('/interview_record/create', interviewRecordInfo).then(res => res.data);
+    try {
+      const response = await http.post('/interview_record/create', interviewRecordInfo);
+      if (response !== null) {
+        return response.data;
+      } else {
+        throw new Error('http.post returned null-like value.');
+      }
+    } catch (error) {
+      console.error('An error occurred while creating interview record:', error);
+      // �隞亙甇方���隤斗����身��
+      throw error;
+    }
   }
 
   // 靽格蝝赤閮��

--
Gitblit v1.9.3