1
0
mirror of https://github.com/git-touch/git-touch synced 2024-12-13 08:56:22 +01:00

refactor: fetch policy network only

This commit is contained in:
Rongjian Zhang 2021-07-22 21:57:37 +08:00
parent 7247c05817
commit 594c5de972
2 changed files with 4 additions and 35 deletions

View File

@ -1,7 +1,6 @@
import 'dart:convert';
import 'dart:async';
import 'package:ferry/ferry.dart';
import 'package:git_touch/utils/nil_store.dart';
// import 'package:in_app_review/in_app_review.dart';
import 'package:universal_io/io.dart';
import 'package:git_touch/models/bitbucket.dart';
@ -703,7 +702,10 @@ class AuthModel with ChangeNotifier {
_apiPrefix + '/graphql',
defaultHeaders: {HttpHeaders.authorizationHeader: 'token $token'},
),
cache: Cache(store: NilStore()),
// https://ferrygraphql.com/docs/fetch-policies#default-fetchpolicies
defaultFetchPolicies: {
OperationType.query: FetchPolicy.NetworkOnly,
},
);
}

View File

@ -1,33 +0,0 @@
import 'dart:async';
import 'package:ferry_store/ferry_store.dart';
// This is a cache store to disable cache
class NilStore extends Store {
@override
void clear() {}
@override
void delete(String dataId) {}
@override
void deleteAll(Iterable<String> dataIds) {}
@override
Map<String, dynamic> get(String dataId) {
return {};
}
@override
Iterable<String> get keys => [];
@override
void put(String dataId, Map<String, dynamic>? value) {}
@override
void putAll(Map<String, Map<String, dynamic>?> data) {}
@override
Stream<Map<String, dynamic>> watch(String dataId) {
return Stream.empty();
}
}