mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-25 22:09:15 +02:00
feat:#26 added semester to fetched groups
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user