Implement Webuntis HTTP Api and Display
This commit is contained in:
23
lib/api/webuntis/queries/getSubjects/getSubjectsCache.dart
Normal file
23
lib/api/webuntis/queries/getSubjects/getSubjectsCache.dart
Normal file
@ -0,0 +1,23 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:marianum_mobile/api/requestCache.dart';
|
||||
import 'package:marianum_mobile/api/webuntis/queries/getSubjects/getSubjectsResponse.dart';
|
||||
|
||||
import 'getSubjects.dart';
|
||||
|
||||
class GetSubjectsCache extends RequestCache<GetSubjectsResponse> {
|
||||
GetSubjectsCache({onUpdate}) : super(60 * 60, onUpdate) {
|
||||
start("subjects", "data");
|
||||
}
|
||||
|
||||
@override
|
||||
Future<GetSubjectsResponse> onLoad() {
|
||||
return GetSubjects().run();
|
||||
}
|
||||
|
||||
@override
|
||||
onLocalData(String json) {
|
||||
return GetSubjectsResponse.fromJson(jsonDecode(json));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user