added api endpoint and auto update fix

This commit is contained in:
Kima
2023-09-04 21:45:11 +02:00
parent a401ff32d9
commit 8feea02f68
7 changed files with 77 additions and 31 deletions

View File

@@ -73,8 +73,16 @@ class HomeworkProvider with ChangeNotifier {
if (user == null) throw "Cannot fetch Homework for User null";
String iss = user.instituteCode;
List? homeworkJson = await Provider.of<KretaClient>(_context, listen: false)
.getAPI(KretaAPI.homework(iss, start: from));
List? homeworkJson = [];
try {
homeworkJson = await Provider.of<KretaClient>(_context, listen: false)
.getAPI(KretaAPI.homework(iss, start: from));
} catch (e) {
// error fetcing homework (unknown error)
}
if (homeworkJson == null) throw "Cannot fetch Homework for User ${user.id}";
List<Homework> homework = [];