feat:#26 added semester to fetched groups

This commit is contained in:
Elmar Kresse
2024-02-02 00:25:26 +01:00
parent 116a8dc37e
commit 25a7464e41
12 changed files with 5365 additions and 45 deletions

View File

@@ -20,6 +20,24 @@ export async function fetchCourse(): Promise<string[]> {
return courses;
}
export async function fetchCourseBySemester(semester: string): Promise<string[]> {
const courses: string[] = [];
await fetch("/api/courses?semester=" + semester)
.then((response) => {
//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));
});
return courses;
}
export async function fetchModulesByCourseAndSemester(
course: string,
semester: string,