mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2026-01-17 10:32:25 +01:00
fix:#3 refactored functions
This commit is contained in:
@@ -21,17 +21,16 @@ import FullCalendar from "@fullcalendar/vue3";
|
||||
import dayGridPlugin from "@fullcalendar/daygrid";
|
||||
import interactionPlugin from "@fullcalendar/interaction";
|
||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
||||
import { computed, ComputedRef, inject, ref, Ref } from "vue";
|
||||
import { CalendarOptions, DatesSetArg, EventInput } from "@fullcalendar/core";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import {computed, ComputedRef, inject, ref, Ref, watch} from "vue";
|
||||
import {CalendarOptions, DatesSetArg, EventInput} from "@fullcalendar/core";
|
||||
import {useI18n} from "vue-i18n";
|
||||
import allLocales from "@fullcalendar/core/locales-all";
|
||||
import router from "@/router";
|
||||
import { formatYearMonthDay } from "@/helpers/dates";
|
||||
import { useQuery } from "@tanstack/vue-query";
|
||||
import { watch } from "vue";
|
||||
import { fetchRoomOccupancy } from "@/api/fetchRoomOccupancy";
|
||||
import { isValid } from "date-fns";
|
||||
import { RoomOccupancyList } from "@/model/roomOccupancyList";
|
||||
import {formatYearMonthDay} from "@/helpers/dates";
|
||||
import {useQuery} from "@tanstack/vue-query";
|
||||
import {fetchRoomOccupancy} from "@/api/fetchRoomOccupancy";
|
||||
import {isValid} from "date-fns";
|
||||
import {RoomOccupancyList} from "@/model/roomOccupancyList";
|
||||
|
||||
const { t } = useI18n({ useScope: "global" });
|
||||
|
||||
@@ -78,17 +77,16 @@ const selectedRoom = computed(() => props.room);
|
||||
* @returns Anonymized occupancy events
|
||||
*/
|
||||
function transformData(data: RoomOccupancyList) {
|
||||
const events = data
|
||||
.decodeOccupancy(
|
||||
selectedRoom.value,
|
||||
new Date(currentDateFrom.value),
|
||||
new Date(currentDateTo.value),
|
||||
)
|
||||
.map((event, index) => ({
|
||||
id: index,
|
||||
event: event,
|
||||
}));
|
||||
return events;
|
||||
return data
|
||||
.decodeOccupancy(
|
||||
selectedRoom.value,
|
||||
new Date(currentDateFrom.value),
|
||||
new Date(currentDateTo.value),
|
||||
)
|
||||
.map((event, index) => ({
|
||||
id: index,
|
||||
event: event,
|
||||
}));
|
||||
}
|
||||
|
||||
const { data: occupancy } = useQuery({
|
||||
|
||||
Reference in New Issue
Block a user