Fixed: [弱掃] p7-Bad use of null-like value
| | |
| | | return http.post('/appointment/memo/create', memoInfo).then(res => res.data); |
| | | } |
| | | |
| | | // 編輯註記 |
| | | /** |
| | | * 編輯註記 |
| | | * @param memoInfo 包含編輯註記相關資訊的物件 |
| | | * @returns 回傳更新後的註記資訊 |
| | | */ |
| | | async updateMemo(memoInfo: updatedMemoInfo): Promise<AppointmentMemoInfo> { |
| | | return http.post('/appointment/memo/update', memoInfo).then(res => res.data); |
| | | try { |
| | | const response = await http.post('/appointment/memo/update', 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 updating memo:', error); |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | |
| | | // 刪除註記 |
| | | deleteMemo(appointmentMemoId: number) { |
| | | return http.delete(`/appointment/memo/${appointmentMemoId}`) |