fix:#79 added check for token and response feedback with toast

This commit is contained in:
masterElmar
2023-11-20 21:11:42 +01:00
parent ecb43abd6a
commit cf07db861f
4 changed files with 24 additions and 10 deletions

View File

@ -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);
}