保誠-保戶業務員媒合平台
jack
2023-09-05 3ecee0fa557b7bb9e83b67e289b316f04efa9ce5
PAMapp/shared/services/query-consultant.service.ts
@@ -61,12 +61,14 @@
   */
  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.');
      }
      // 弱掃Test4: 改為 promise.then 寫法
      return http.post('/appointment/customer/create', data).then((res) => {
        if (res) {
          return res['data'];
        } else {
          throw new Error('http.post returned null-like value.');
        }
      })
    } catch (error) {
      // 可以在此處處理錯誤或回傳預設值
      console.error('An error occurred while creating appointment demand:', error);