mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-29 07:49:14 +02:00
feat:#60 added switch button (not working)
This commit is contained in:
@@ -6,7 +6,13 @@ export async function fetchCourse(): Promise<string[]> {
|
||||
const courses: string[] = [];
|
||||
await fetch("/api/courses")
|
||||
.then((response) => {
|
||||
return response.json();
|
||||
//check if response type is json
|
||||
const contentType = response.headers.get("content-type");
|
||||
if (contentType && contentType.indexOf("application/json") !== -1) {
|
||||
return response.json();
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
})
|
||||
.then((coursesResponse) => {
|
||||
coursesResponse.forEach((course: string) => courses.push(course));
|
||||
|
Reference in New Issue
Block a user