Added reactivity when adding an event

This commit is contained in:
Alexis
2024-06-03 21:39:19 +02:00
parent 5332b4c9c4
commit 9802266b8c
7 changed files with 81 additions and 71 deletions

View File

@@ -19,8 +19,18 @@ export default defineEventHandler(async (event) => {
const { data, error } = await client
.from('calendar_events')
.insert({ start_date: bodyData?.event.startDate, end_date: bodyData.event.endDate, title: bodyData?.event.title, description: bodyData.event.description, calendar_id: bodyData?.calendarId } as never)
.select()
.returns<CalendarEvent>()
.select(`
id,
title,
description,
hidden,
startDate:start_date,
endDate:end_date,
wiki,
category:calendar_event_categories!calendar_events_category_fkey (*),
secondaryCategories:calendar_event_categories!calendar_event_categories_links (*)
`)
.single<CalendarEvent>()
if (error) throw error