diff options
author | Christopher Ng <chrng8@gmail.com> | 2023-08-02 19:15:00 -0700 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2023-08-09 10:41:17 -0700 |
commit | efed517976e3bcf8d27255a965585f5997913373 (patch) | |
tree | 6250433b90e900794a62ac4f79b1c2eb6350c891 /apps/files_reminders/src | |
parent | 71943eb1a4b8e40182a33ea722e9147f593bcb9a (diff) | |
download | nextcloud-server-efed517976e3bcf8d27255a965585f5997913373.tar.gz nextcloud-server-efed517976e3bcf8d27255a965585f5997913373.zip |
fix: due date nullable
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/files_reminders/src')
-rw-r--r-- | apps/files_reminders/src/services/reminderService.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/files_reminders/src/services/reminderService.ts b/apps/files_reminders/src/services/reminderService.ts index ed22307b677..bcfa09e2b78 100644 --- a/apps/files_reminders/src/services/reminderService.ts +++ b/apps/files_reminders/src/services/reminderService.ts @@ -24,15 +24,16 @@ import axios from '@nextcloud/axios' import { generateOcsUrl } from '@nextcloud/router' interface Reminder { - dueDate: Date + dueDate: null | Date } export const getReminder = async (fileId: number): Promise<Reminder> => { const url = generateOcsUrl('/apps/files_reminders/api/v1/get/{fileId}', { fileId }) const response = await axios.get(url) + const dueDate = response.data.dueDate ? new Date(response.data.dueDate) : null return { - dueDate: new Date(response.data.ocs.data.dueDate), + dueDate, } } @@ -40,15 +41,15 @@ export const setReminder = async (fileId: number, dueDate: Date): Promise<[]> => const url = generateOcsUrl('/apps/files_reminders/api/v1/set/{fileId}', { fileId }) const response = await axios.put(url, { - dueDate: dueDate.toISOString(), + dueDate: dueDate.toISOString(), // timezone of string is always UTC }) - return response.data.ocs.data + return response.data } export const clearReminder = async (fileId: number): Promise<[]> => { const url = generateOcsUrl('/apps/files_reminders/api/v1/remove/{fileId}', { fileId }) const response = await axios.delete(url) - return response.data.ocs.data + return response.data } |