Fixed: [弱掃] p8.2 Bad use of null-like value
| | |
| | | return http.put('/appointment', editAppointmentParams); |
| | | } |
| | | |
| | | // 新增註記 |
| | | /** |
| | | * 新增註記 |
| | | * @param memoInfo 包含新增註記相關資訊的物件 |
| | | * @returns 回傳新增的註記資訊 |
| | | */ |
| | | async createMemo(memoInfo: createdMemoInfo): Promise<AppointmentMemoInfo> { |
| | | return http.post('/appointment/memo/create', memoInfo).then(res => res.data); |
| | | try { |
| | | const response = await http.post('/appointment/memo/create', memoInfo); |
| | | 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 memo:', error); |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 編輯註記 |
| | | * @param memoInfo 包含編輯註記相關資訊的物件 |