From 18f5025473e221a9fb0b6312dfc3fa53117e9b44 Mon Sep 17 00:00:00 2001 From: Elmar Kresse Date: Tue, 26 Mar 2024 23:58:24 +0100 Subject: [PATCH] feat:#46 fixed double requests --- frontend/src/components/RoomOccupation.vue | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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();