feat:#5 added datetime input for search and fixed nav bar

This commit is contained in:
Elmar Kresse
2024-01-24 18:34:40 +01:00
parent c90577e6e5
commit 82899a6f08
12 changed files with 479 additions and 336 deletions

View File

@@ -6,8 +6,8 @@ export async function fetchRoom(): Promise<string[]> {
.then((response) => {
return response.json();
})
.then((roomsResponse) => {
roomsResponse.forEach((room: string) => rooms.push(room));
.then((roomsResponse: [] | null) => {
roomsResponse?.forEach((room: string) => rooms.push(room));
});
return rooms;
}
@@ -22,17 +22,15 @@ export async function fetchEventsByRoomAndDuration(
"/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: AnonymizedEventDTO) => events.push(event));
.then((eventsResponse: [] | null) => {
eventsResponse?.forEach((event: AnonymizedEventDTO) =>
events.push(event),
);
})
.catch((error) => {
console.log("Error fetching events: ", error);
return Promise.reject(error);
});
console.log("occupations: ", events);
return events;
}