diff --git a/frontend/src/components/RoomOccupation.vue b/frontend/src/components/RoomOccupation.vue index 5acb041..148df7b 100644 --- a/frontend/src/components/RoomOccupation.vue +++ b/frontend/src/components/RoomOccupation.vue @@ -28,9 +28,6 @@ type CalenderEvent = { const date: Ref = ref(new Date()); -// Watch for changes in URL parameter -router.afterEach(setDateFromQuery); - // Set the selected date from the URL function setDateFromQuery() { const queryDate = router.currentRoute.value.query.date; @@ -81,9 +78,9 @@ async function getOccupation() { showFree: event.free, }; }); - - const calendar = fullCalendar.value?.getApi(); - calendar?.refetchEvents(); + }) + .finally(() => { + fullCalendar.value?.getApi().refetchEvents(); }) .catch((error) => { console.error(error); @@ -157,7 +154,7 @@ const calendarOptions: ComputedRef = computed(() => ({ router.replace({ query: { ...router.currentRoute.value.query, - date: formatYearMonthDay(startDate), + date: formatYearMonthDay(endDate), }, }); getOccupation();