fix: disallow duplicate creation

Contributes to #25
This commit is contained in:
2025-06-06 03:26:15 +01:00
parent cf8d4725f7
commit 022d9089e0

View File

@@ -12,6 +12,7 @@
const { supabase } = $derived(data);
let spaceImgs = $state<FileList>();
let uploading = $state(false);
let studySpaceData = $state<Omit<Table<"study_spaces">, "id" | "created_at" | "updated_at">>({
description: "",
building_location: "",
@@ -73,7 +74,9 @@
<form
onsubmit={async (event) => {
event.preventDefault();
uploading = true;
await uploadStudySpace();
uploading = false;
}}
>
<Images name="study-space-image" minHeight="16rem" bind:files={spaceImgs} required />
@@ -109,7 +112,8 @@
disabled={(spaceImgs?.length || 0) === 0 ||
!studySpaceData.location ||
!studySpaceData.description ||
!studySpaceData.building_location}
!studySpaceData.building_location ||
uploading}
>
Share this study space!
</Button>