mirror of
https://github.com/git-touch/git-touch
synced 2025-01-06 12:56:43 +01:00
fix: github gql query
This commit is contained in:
parent
36e505d511
commit
7a71d13f7d
@ -107,7 +107,7 @@ class AuthModel with ChangeNotifier {
|
||||
await loginWithToken(token);
|
||||
}
|
||||
|
||||
Future<void> loginWithToken(String token) async {
|
||||
Future<void> loginWithToken(String t) async {
|
||||
try {
|
||||
final queryData = await query('''
|
||||
{
|
||||
@ -116,12 +116,12 @@ class AuthModel with ChangeNotifier {
|
||||
avatarUrl
|
||||
}
|
||||
}
|
||||
''', token);
|
||||
''', t);
|
||||
|
||||
await _addAccount(Account(
|
||||
platform: PlatformType.github,
|
||||
domain: 'https://github.com',
|
||||
token: token,
|
||||
token: t,
|
||||
login: queryData['viewer']['login'] as String,
|
||||
avatarUrl: queryData['viewer']['avatarUrl'] as String,
|
||||
));
|
||||
@ -716,13 +716,13 @@ class AuthModel with ChangeNotifier {
|
||||
);
|
||||
}
|
||||
|
||||
Future<dynamic> query(String query, [String? token]) async {
|
||||
token ??= token;
|
||||
Future<dynamic> query(String query, [String? t]) async {
|
||||
t ??= token;
|
||||
|
||||
final res = await http
|
||||
.post(Uri.parse('$_apiPrefix/graphql'),
|
||||
headers: {
|
||||
HttpHeaders.authorizationHeader: 'token $token',
|
||||
HttpHeaders.authorizationHeader: 'token $t',
|
||||
HttpHeaders.contentTypeHeader: 'application/json'
|
||||
},
|
||||
body: json.encode({'query': query}))
|
||||
|
Loading…
Reference in New Issue
Block a user