fix: Fixed uploading study space error which subsequently fixes persistent favouriting now

Co-Authored-By: Tadios Temesgen <tt2022@ic.ac.uk>
This commit is contained in:
Caspar Jojo Asaam
2025-06-13 09:41:27 +01:00
parent ee190d90db
commit 93b3bf23be

View File

@@ -37,11 +37,8 @@
$effect(() => {
if (!space) return;
const { opening_times, ...rest } = space;
Object.assign(studySpaceData, rest);
if (opening_times) {
studySpaceData.opening_times = opening_times;
}
Object.assign(studySpaceData, space);
studySpaceData.opening_times = space.opening_times ?? [];
});
let scrollPosition = $state(0);
@@ -137,7 +134,10 @@
if (!spaceImgs || spaceImgs.length < 1) return alert("Please select an image file.");
if (!studySpaceData.building_location) return alert("Please select a building location.");
const { ...spacePayload } = studySpaceData;
const { opening_times, ...spacePayload } = studySpaceData;
// explicitly mark opening_times as used to avoid unused warning
void opening_times;
const { data: studySpaceInsert, error: studySpaceError } = await supabase
.from("study_spaces")