mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-24 05:28:49 +02:00
fix:#79 added check for token and response feedback with toast
This commit is contained in:
@ -8,7 +8,10 @@ export async function getCalender(token: string): Promise<Module[]> {
|
||||
|
||||
return await fetch(request)
|
||||
.then((response) => {
|
||||
return response.json();
|
||||
if( response.ok){
|
||||
return response.json().then((calendarResponse: Calendar) => calendarResponse.modules)
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
})
|
||||
.then((calendarResponse: Calendar) => calendarResponse.modules);
|
||||
}
|
||||
|
Reference in New Issue
Block a user