Closed TesfahunK closed 1 year ago
@TesfahunK could you share your solution, please?
@wildsurfer Sure , here is my workaround
Context customGraphQueryContext({String? role, Map<String, String>? headers}) {
return Context.fromList(
[
HttpLinkHeaders(
headers: headers ?? {"x-hasura-role": role!},
),
],
);
}
you can use the above Context in your MutationOptions
& QueryOptions
paramenters of your Query or Mutation widgets
I have recently ran into a situation where i have to attach custom header for some queries and mutations on my app, the docs indicate that this package support a Context for an operation but fails to give any example, is there any example that shows the use of a
Context
in Query/Mutation widget? if there is none can you please include that in the docs?Thanks