From efed517976e3bcf8d27255a965585f5997913373 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Wed, 2 Aug 2023 19:15:00 -0700 Subject: [PATCH] fix: due date nullable Signed-off-by: Christopher Ng --- apps/files_reminders/src/services/reminderService.ts | 11 ++++++----- 1 file 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 => { 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 } -- 2.39.5