mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-07-16 17:48:51 +02:00
feat:#46 fixed double requests
This commit is contained in:
@ -28,9 +28,6 @@ type CalenderEvent = {
|
|||||||
|
|
||||||
const date: Ref<Date> = ref(new Date());
|
const date: Ref<Date> = ref(new Date());
|
||||||
|
|
||||||
// Watch for changes in URL parameter
|
|
||||||
router.afterEach(setDateFromQuery);
|
|
||||||
|
|
||||||
// Set the selected date from the URL
|
// Set the selected date from the URL
|
||||||
function setDateFromQuery() {
|
function setDateFromQuery() {
|
||||||
const queryDate = router.currentRoute.value.query.date;
|
const queryDate = router.currentRoute.value.query.date;
|
||||||
@ -81,9 +78,9 @@ async function getOccupation() {
|
|||||||
showFree: event.free,
|
showFree: event.free,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
})
|
||||||
const calendar = fullCalendar.value?.getApi();
|
.finally(() => {
|
||||||
calendar?.refetchEvents();
|
fullCalendar.value?.getApi().refetchEvents();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -157,7 +154,7 @@ const calendarOptions: ComputedRef<CalendarOptions> = computed(() => ({
|
|||||||
router.replace({
|
router.replace({
|
||||||
query: {
|
query: {
|
||||||
...router.currentRoute.value.query,
|
...router.currentRoute.value.query,
|
||||||
date: formatYearMonthDay(startDate),
|
date: formatYearMonthDay(endDate),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
getOccupation();
|
getOccupation();
|
||||||
|
Reference in New Issue
Block a user