From 7692f9d503a1f54627110fc8b670dfe881275cc6 Mon Sep 17 00:00:00 2001 From: Levente Orban Date: Tue, 28 Oct 2025 19:16:36 +0100 Subject: [PATCH] fix: error when editing the events, location_type --- src/routes/event/[id]/edit/+page.server.ts | 7 +++---- src/routes/event/[id]/edit/+page.svelte | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/routes/event/[id]/edit/+page.server.ts b/src/routes/event/[id]/edit/+page.server.ts index fd61dd0..c866f6b 100644 --- a/src/routes/event/[id]/edit/+page.server.ts +++ b/src/routes/event/[id]/edit/+page.server.ts @@ -76,7 +76,7 @@ export const actions: Actions = { const date = formData.get('date') as string; const time = formData.get('time') as string; const location = formData.get('location') as string; - const locationType = formData.get('location_type') as 'none' | 'text' | 'maps'; + const locationType = formData.get('locationType') as string; const locationUrl = formData.get('location_url') as string; const type = formData.get('type') as 'limited' | 'unlimited'; const attendeeLimit = formData.get('attendee_limit') as string; @@ -109,7 +109,7 @@ export const actions: Actions = { }); } - // Check if date is in the past using local timezone (but allow editing past events for corrections) + // Check if date is in the past using local timezone const [year, month, day] = date.split('-').map(Number); const eventDate = new Date(year, month - 1, day); const today = new Date(); @@ -148,7 +148,6 @@ export const actions: Actions = { } }); } - // Update the event await database .update(events) @@ -157,7 +156,7 @@ export const actions: Actions = { date: date, time: time, location: location?.trim() || '', - locationType: locationType, + locationType: locationType as 'none' | 'text' | 'maps', locationUrl: locationType === 'maps' ? locationUrl?.trim() : null, type: type, attendeeLimit: type === 'limited' ? parseInt(attendeeLimit) : null, diff --git a/src/routes/event/[id]/edit/+page.svelte b/src/routes/event/[id]/edit/+page.svelte index 676f3be..bbf0ebd 100644 --- a/src/routes/event/[id]/edit/+page.svelte +++ b/src/routes/event/[id]/edit/+page.svelte @@ -1,5 +1,5 @@