Revert "Add page to check for room availability "

This commit is contained in:
masterElmar
2023-11-01 17:44:42 +01:00
committed by GitHub
parent f1229fad27
commit 59a02f72e8
32 changed files with 82 additions and 1541 deletions

View File

@@ -1,36 +0,0 @@
import {Event} from "../model/event.ts";
export async function fetchRoom(): Promise<string[]> {
const rooms: string[] = [];
await fetch("/api/rooms")
.then((response) => {
return response.json();
})
.then((roomsResponse) => {
roomsResponse.forEach((room: string) => rooms.push(room));
});
return rooms;
}
export async function fetchEventsByRoomAndDuration(
room: string,
from_date: string,
to_date: string,
): Promise<Event[]> {
const events: Event[] = [];
await fetch("/api/schedule?room=" + room + "&from=" + from_date + "&to=" + to_date)
.then((response) => {
console.log(response);
return response.json();
})
.then((eventsResponse) => {
console.log("Response:", eventsResponse);
eventsResponse.forEach((event: Event) =>
events.push(event));
}).catch((error) => {
console.log("Error fetching events: ", error);
return null;
})
console.log("occupations: ", events);
return events;
}