From: Christopher Ng Date: Thu, 3 Aug 2023 02:15:00 +0000 (-0700) Subject: fix: due date nullable X-Git-Tag: v27.1.0beta2~35^2~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c25ed870d8537a6b2d64f84c21a4eb4196be9c55;p=nextcloud-server.git fix: due date nullable Signed-off-by: Christopher Ng (cherry picked from commit efed517976e3bcf8d27255a965585f5997913373) --- 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 }