From 80b723216ca016f0438866cc99f6695c22990514 Mon Sep 17 00:00:00 2001 From: Tomas <tomasysh@gmail.com> Date: 星期六, 05 八月 2023 16:52:11 +0800 Subject: [PATCH] Fixed: [弱掃] p9.2 Bad use of null-like value --- PAMapp/shared/services/query-consultant.service.ts | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/PAMapp/shared/services/query-consultant.service.ts b/PAMapp/shared/services/query-consultant.service.ts index fdc5507..d7fa8aa 100644 --- a/PAMapp/shared/services/query-consultant.service.ts +++ b/PAMapp/shared/services/query-consultant.service.ts @@ -30,11 +30,27 @@ return http.post('/consultant/favorite', payload); } - // ����岷��� - async appointmentDemand(data: AppointmentParams) { - return http.post('/appointment/customer/create', data).then((res) => res.data); + /** + * ����瘙� + * @param data ������瘙�����隞� + * @returns ������瘙��� + */ + async appointmentDemand(data: AppointmentParams) { + try { + const response = await http.post('/appointment/customer/create', data); + 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 appointment demand:', error); + throw error; + } } + } export default new QueryConsultantService(); -- Gitblit v1.8.0