Client
Configuration
const client = new Client({
url: "/path/to/gql",
});
Params
url
(mandatory): the URL of your GraphQL APIschemaConfig
(mandatory): your generated schema configheaders
(optional): the default headers to sendmakeRequest
(optional): function that performs the request and returns aFuture<Result<unknown, ClientError>>
(e.g. to add request IDs, custom parsing of the payload, logging & custom error handling)
Perform a query
client.query(query, variables).tap((result) => {
console.log(result);
});
Perform a mutation
client.commitMutation(mutation, variables).tap((result) => {
console.log(result);
});