react-query-gql
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -5,2 +5,4 @@ # Changelog | ||
### [0.0.6](https://github.com/correttojs/graphql-codegen-apollo-next-ssr/compare/v0.0.5...v0.0.6) (2021-05-03) | ||
### [0.0.5](https://github.com/correttojs/graphql-codegen-apollo-next-ssr/compare/v0.0.4...v0.0.5) (2021-05-03) | ||
@@ -7,0 +9,0 @@ |
import { TypedDocumentNode } from "@graphql-typed-document-node/core"; | ||
export declare const gqlRequest: <TData, TVariables>(document: TypedDocumentNode<TData, TVariables>, variables?: TVariables) => Promise<TData>; | ||
export declare const gqlRequest: <TData, TVariables>(document: TypedDocumentNode<TData, TVariables>, variables?: TVariables, url?: string) => Promise<TData>; |
import { GraphQLClient } from 'graphql-request'; | ||
import { useQuery, useMutation, QueryClient } from 'react-query'; | ||
const client = new GraphQLClient(`/api/graphql`); | ||
const gqlRequest = (document, variables) => client.request(document, variables); | ||
const gqlRequest = (document, variables, url = `/api/graphql`) => new GraphQLClient(url).request(document, variables); | ||
@@ -12,3 +11,3 @@ const useReactQuery = (document, variables, options) => { | ||
const useReactMutation = (document, options) => { | ||
return useMutation((variables) => gqlRequest(document, variables), options); | ||
return useMutation((variables) => gqlRequest(document, variables, options === null || options === void 0 ? void 0 : options.url), options); | ||
}; | ||
@@ -15,0 +14,0 @@ |
import { TypedDocumentNode } from "@graphql-typed-document-node/core"; | ||
import { UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "react-query"; | ||
export declare const useReactQuery: <TData, TVariables, TError = unknown>(document: TypedDocumentNode<TData, TVariables>, variables?: TVariables, options?: UseQueryOptions<TData, any, TData, import("react-query").QueryKey>) => UseQueryResult<TData, any>; | ||
export declare const useReactMutation: <TData, TVariables, TError = unknown, TContext = unknown>(document: TypedDocumentNode<TData, TVariables>, options?: UseMutationOptions<TData, TError, TVariables, TContext>) => UseMutationResult<TData, TError, TVariables, TContext>; | ||
export declare const useReactMutation: <TData, TVariables, TError = unknown, TContext = unknown>(document: TypedDocumentNode<TData, TVariables>, options?: UseMutationOptions<TData, TError, TVariables, TContext> & { | ||
url: string; | ||
}) => UseMutationResult<TData, TError, TVariables, TContext>; |
{ | ||
"name": "react-query-gql", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "React Query Gql Client", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12435
263