@madxnl/chessur
v0.0.13
Published
Frontend helpers for madhatter apps
Downloads
291
Readme
Frontend SDK for madhatter apps
Setup
To use the SDK initialize it with a GraphQLClient
import { GraphQLClient } from 'graphql-request'
import { MadhatterGraphQLClient } from '@madxnl/chessur'
const client = new GraphQLClient(baseURL, options)
const madhatterGraphqlClient = new MadhatterGraphQLClient(client)
To enforce type safety you can supply Query and Mutation types.
import { Query, Mutation, MutationVariables, QueryVariables } from '@/generated/sdk'
export const madhatterGraphqlClient =
new MadhatterGraphQLClient<
Query,
Mutation,
QueryVariables,
MutationVariables
>(client)
The Codegen Plugin provided by the library prepares you the neccesary types.
Codegen Plugin
To use the Codegen plugin simply include it in your codegen configuration.
In codegen.yml
:
...
generates:
src/generated/sdk.ts:
...
plugins:
...
- '@madxnl/chessur/codegen-plugin'