api and storage restructure
This commit is contained in:
1 parent
4f796dac2e
commit
9b5a70b285
53 files changed
+318
-460
No files matched your search
@@ -1,27 +1,14 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import '../../../requestCache.dart';
|
||||
import 'getSubjects.dart';
|
||||
import 'getSubjectsResponse.dart';
|
||||
|
||||
class GetSubjectsCache extends RequestCache<GetSubjectsResponse> {
|
||||
GetSubjectsCache({
|
||||
void Function(GetSubjectsResponse)? onUpdate,
|
||||
void Function(Exception)? onError,
|
||||
bool? renew,
|
||||
}) : super(
|
||||
RequestCache.cacheHour,
|
||||
onUpdate,
|
||||
onError: onError ?? RequestCache.ignore,
|
||||
renew: renew,
|
||||
class GetSubjectsCache extends SimpleCache<GetSubjectsResponse> {
|
||||
GetSubjectsCache({super.onUpdate, super.onError, super.renew})
|
||||
: super(
|
||||
cacheTime: RequestCache.cacheHour,
|
||||
loader: () => GetSubjects().run(),
|
||||
fromJson: GetSubjectsResponse.fromJson,
|
||||
) {
|
||||
start('wu-subjects');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<GetSubjectsResponse> onLoad() => GetSubjects().run();
|
||||
|
||||
@override
|
||||
onLocalData(String json) => GetSubjectsResponse.fromJson(jsonDecode(json));
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user