mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2026-01-16 22:12:25 +01:00
19 lines
489 B
TypeScript
19 lines
489 B
TypeScript
import { Module } from "../model/module";
|
|
import { Calendar } from "../model/calendar";
|
|
|
|
export async function getCalender(token: string): Promise<Module[]> {
|
|
const request = new Request("/api/collections/feeds/records/" + token, {
|
|
method: "GET",
|
|
});
|
|
|
|
return await fetch(request).then((response) => {
|
|
if (response.ok) {
|
|
return response
|
|
.json()
|
|
.then((calendarResponse: Calendar) => calendarResponse.modules);
|
|
} else {
|
|
return [];
|
|
}
|
|
});
|
|
}
|