Fix creating and deleting calendars

This fixes the creation and deletion of calendars to include a color and the proper chosen name.
This commit is contained in:
Bruno Bernardino
2025-09-06 19:17:48 +01:00
parent 24944de0f6
commit 49dbc724c8
8 changed files with 30 additions and 10 deletions

View File

@@ -37,6 +37,11 @@ export default function Calendars({ initialCalendars }: CalendarsProps) {
method: 'POST',
body: JSON.stringify(requestBody),
});
if (!response.ok) {
throw new Error(`Failed to add calendar! ${response.statusText} ${await response.text()}`);
}
const result = await response.json() as AddResponseBody;
if (!result.success) {
@@ -65,6 +70,11 @@ export default function Calendars({ initialCalendars }: CalendarsProps) {
method: 'POST',
body: JSON.stringify(requestBody),
});
if (!response.ok) {
throw new Error(`Failed to delete calendar! ${response.statusText} ${await response.text()}`);
}
const result = await response.json() as DeleteResponseBody;
if (!result.success) {