feat:#26 switch to course route only for courses that have events

This commit is contained in:
Elmar Kresse
2024-02-04 00:55:49 +01:00
parent 4878499650
commit 4cf2067736

View File

@ -24,7 +24,7 @@ export async function fetchCourseBySemester(
semester: string, semester: string,
): Promise<string[]> { ): Promise<string[]> {
const courses: string[] = []; const courses: string[] = [];
await fetch("/api/courses?semester=" + semester) await fetch("/api/courses/events?semester=" + semester)
.then((response) => { .then((response) => {
//check if response type is json //check if response type is json
const contentType = response.headers.get("content-type"); const contentType = response.headers.get("content-type");
@ -35,7 +35,7 @@ export async function fetchCourseBySemester(
} }
}) })
.then((coursesResponse) => { .then((coursesResponse) => {
coursesResponse.forEach((course: string) => courses.push(course)); coursesResponse?.forEach((course: string) => courses.push(course));
}); });
return courses; return courses;
} }