保誠-保戶業務員媒合平台
Tomas
2023-09-05 2f6a811d35ac75acd8c000778b9270a9f4409d9e
PAMapp/shared/services/appointment.service.ts
@@ -57,10 +57,11 @@
  async createMemo(memoInfo: createdMemoInfo): Promise<AppointmentMemoInfo> {
    try {
      const response = await http.post('/appointment/memo/create', memoInfo);
      if (response !== null) {
        return response.data;
      } else {
      // 弱掃 test2: 改為判斷 !response
      if (!response) {
        throw new Error('http.post returned null-like value.');
      } else {
        return response.data;
      }
    } catch (error) {
      // 可以在此處處理錯誤或回傳預設值
@@ -104,13 +105,13 @@
  async closeAppointment(appointmentInfo: ToDoneAppointment | ToCloseAppointment) {
    try {
      const response = await http.post(`/appointment/close`, appointmentInfo);
      if (response !== null) {
        return response.data;
      if (!response) {
        throw new Error('http.post returned a null-like value.');
      } else {
        throw new Error('http.post returned null-like value.');
        return response.data;
      }
    } catch (error) {
      // 可以在此處處理錯誤或回傳預設值
      // 在這裡處理錯誤,例如回傳預設值或記錄錯誤訊息
      console.error('An error occurred while closing appointment:', error);
      throw error;
    }