| | |
| | | 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; |
| | | } |
| | |
| | | |
| | | // 約訪通知 API |
| | | async informAppointment(appointmentInformation: ToInformAppointment) { |
| | | return http.post(`/notice/send`, appointmentInformation).then((res) => res.data); |
| | | try { |
| | | const response = await http.post(`/notice/send`, appointmentInformation); |
| | | if (response !== null) { |
| | | return response.data; |
| | | } else { |
| | | throw new Error('http.post returned null-like value.'); |
| | | } |
| | | } catch (error) { |
| | | console.error('An error occurred while informing appointment:', error); |
| | | // 可以在此處處理錯誤或回傳預設值 |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | |
| | | // 新增約訪記錄 |
| | | async createInterviewRecord(interviewRecordInfo: InterviewRecordInfo) { |
| | | return http.post('/interview_record/create', interviewRecordInfo).then(res => res.data); |
| | | try { |
| | | const response = await http.post('/interview_record/create', interviewRecordInfo); |
| | | 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 interview record:', error); |
| | | // 可以在此處處理錯誤或回傳預設值 |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | // 修改約訪記錄 |