Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export function graphql<
- TProps extends TGraphQLVariables | {} = {},
- TData = {},
- TGraphQLVariables = {},
- TChildProps = Partial<DataProps<TData, TGraphQLVariables>> &
- Partial<MutateProps<TData, TGraphQLVariables>>
- >(
- document: DocumentNode,
- operationOptions: OperationOption<TProps, TData, TGraphQLVariables, TChildProps> = {},
- ) {
- switch (parser(document).type) {
- case DocumentType.Mutation:
- return mutation(document, operationOptions);
- case DocumentType.Subscription:
- return subscribe(document, operationOptions);
- // case DocumentType.Fragment:
- // throw new Error('fragments cannont currently be used on their own');
- case DocumentType.Query:
- default:
- return query(document, operationOptions);
- }
- }
Add Comment
Please, Sign In to add comment