Fixed: [弱掃] p9.2 Bad use of null-like value
| | |
| | | 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(); |