保誠-保戶業務員媒合平台
Tomas
2023-08-05 1adfdb0ffed271b97cf88471c94ab2735dc12b35
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;
    }
  }
  // 讀取預約單時觸發,紀錄讀取預約單時間
@@ -87,11 +96,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);