mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-07 00:24:18 +00:00
chore: Rename '_getApiToken' to 'get _token' for GraphQL API map
This commit is contained in:
parent
08f3258615
commit
27aaf93838
|
@ -74,13 +74,11 @@ abstract class GraphQLApiMap {
|
|||
defaultHeaders: {'Accept-Language': _locale},
|
||||
);
|
||||
|
||||
final String token = _getApiToken();
|
||||
|
||||
final Link graphQLLink = RequestLoggingLink().concat(
|
||||
isWithToken
|
||||
? AuthLink(
|
||||
getToken: () async =>
|
||||
customToken == '' ? 'Bearer $token' : customToken,
|
||||
customToken == '' ? 'Bearer $_token' : customToken,
|
||||
).concat(httpLink)
|
||||
: httpLink,
|
||||
);
|
||||
|
@ -96,16 +94,14 @@ abstract class GraphQLApiMap {
|
|||
}
|
||||
|
||||
Future<GraphQLClient> getSubscriptionClient() async {
|
||||
final String token = _getApiToken();
|
||||
|
||||
final WebSocketLink webSocketLink = WebSocketLink(
|
||||
'ws://api.$rootAddress/graphql',
|
||||
config: SocketClientConfig(
|
||||
autoReconnect: true,
|
||||
headers: token.isEmpty
|
||||
headers: _token.isEmpty
|
||||
? null
|
||||
: {
|
||||
'Authorization': 'Bearer $token',
|
||||
'Authorization': 'Bearer $_token',
|
||||
'Accept-Language': _locale,
|
||||
},
|
||||
),
|
||||
|
@ -119,7 +115,7 @@ abstract class GraphQLApiMap {
|
|||
|
||||
String get _locale => getIt.get<ApiConfigModel>().localeCode ?? 'en';
|
||||
|
||||
String _getApiToken() {
|
||||
String get _token {
|
||||
String token = '';
|
||||
final serverDetails = getIt<ApiConfigModel>().serverDetails;
|
||||
if (serverDetails != null) {
|
||||
|
|
Loading…
Reference in a new issue