mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
fix: remove operation name
This commit is contained in:
parent
f2799cacc4
commit
6b095e8a3b
@ -1388,7 +1388,7 @@ class GhUserQuery extends GraphQLQuery<GhUser, GhUserArguments> {
|
||||
]);
|
||||
|
||||
@override
|
||||
final String operationName = null;
|
||||
final String operationName = 'gh_user';
|
||||
|
||||
@override
|
||||
final GhUserArguments variables;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
import 'dart:async';
|
||||
import 'package:git_touch/utils/request_serilizer.dart';
|
||||
import 'package:gql_http_link/gql_http_link.dart';
|
||||
import 'package:artemis/artemis.dart';
|
||||
import 'package:fimber/fimber.dart';
|
||||
@ -192,8 +193,11 @@ class AuthModel with ChangeNotifier {
|
||||
|
||||
if (_gqlClient == null) {
|
||||
_gqlClient = ArtemisClient.fromLink(
|
||||
HttpLink(_apiPrefix + '/graphql',
|
||||
defaultHeaders: {HttpHeaders.authorizationHeader: 'token $token'}),
|
||||
HttpLink(
|
||||
_apiPrefix + '/graphql',
|
||||
defaultHeaders: {HttpHeaders.authorizationHeader: 'token $token'},
|
||||
serializer: GithubRequestSerializer(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
21
lib/utils/request_serilizer.dart
Normal file
21
lib/utils/request_serilizer.dart
Normal file
@ -0,0 +1,21 @@
|
||||
import "package:gql/execution.dart";
|
||||
import "package:gql/language.dart";
|
||||
import 'package:gql_link/gql_link.dart';
|
||||
|
||||
class GithubRequestSerializer extends RequestSerializer {
|
||||
const GithubRequestSerializer();
|
||||
|
||||
@override
|
||||
Map<String, dynamic> serializeRequest(Request request) {
|
||||
final RequestExtensionsThunk thunk = request.context.entry();
|
||||
|
||||
return <String, dynamic>{
|
||||
// Remove operationName here for GitHub API compatibility
|
||||
// "operationName": request.operation.operationName,
|
||||
"variables": request.operation.variables,
|
||||
"query": printNode(request.operation.document),
|
||||
if (thunk != null)
|
||||
"extensions": thunk.getRequestExtensions(request),
|
||||
};
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user