feat:#46 fixed double requests

This commit is contained in:
Elmar Kresse
2024-03-26 23:58:24 +01:00
parent 0d3af8829c
commit 18f5025473

View File

@ -28,9 +28,6 @@ type CalenderEvent = {
const date: Ref<Date> = 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<CalendarOptions> = computed(() => ({
router.replace({
query: {
...router.currentRoute.value.query,
date: formatYearMonthDay(startDate),
date: formatYearMonthDay(endDate),
},
});
getOccupation();