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