Bit ugly, but this at least makes using persisted queries possible:
const client = new AwesomeGraphQLClient<string, RequestInit>({
endpoint: server.endpoint,
formatOperation: operation => {
return JSON.stringify({
...operation,
query: undefined,
id: operation.query // <- pass the id as the argument to client.request instead of the raw graphql
});
},
})
You could also institute logic in this callback to print() the document or pass the id if it exists on an object:
Can be used to address #88
Example:
Bit ugly, but this at least makes using persisted queries possible:
You could also institute logic in this callback to print() the document or pass the id if it exists on an object: