From 19df6b38f10165ef55ea0467826d2cf35345fc91 Mon Sep 17 00:00:00 2001 From: Tomas <tomasysh@gmail.com> Date: 星期六, 05 八月 2023 16:32:49 +0800 Subject: [PATCH] Fixed: [弱掃] p8.1 Bad use of null-like value --- PAMapp/shared/services/reviews.service.ts | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/PAMapp/shared/services/reviews.service.ts b/PAMapp/shared/services/reviews.service.ts index 48a55a0..9982078 100644 --- a/PAMapp/shared/services/reviews.service.ts +++ b/PAMapp/shared/services/reviews.service.ts @@ -21,9 +21,24 @@ return http.get('/satisfaction/getMySatisfaction').then(res => res.data); } - // 憿批�蜓���遛��漲� - sendSatisfactionToClient(appointmentId: number) { - return http.post(`/consultant/sendSatisfactionToClient/${appointmentId}`).then((res) => res); + /** + * 憿批�蜓���遛��漲� + * @param appointmentId ����D + * @returns ������� + */ + async sendSatisfactionToClient(appointmentId: number): Promise<any> { + try { + const response = await http.post(`/consultant/sendSatisfactionToClient/${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 sending satisfaction to client:', error); + throw error; + } } // �撠� -- Gitblit v1.8.0