| | |
| | | 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) { |
| | | // 可以在此處處理錯誤或回傳預設值 |
| | |
| | | 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; |
| | | } |