import useSWR, { SWRResponse, SWRConfiguration } from 'swr' import { gqlClient } from '@/lib/tabby-gql-client' import { Variables } from 'graphql-request' import { TypedDocumentNode } from '@graphql-typed-document-node/core' function useGraphQL( document: TypedDocumentNode, variables?: TVariables, swrConfiguration?: SWRConfiguration ): SWRResponse { return useSWR( [document, variables], ([document, variables]) => gqlClient.request(document, variables), swrConfiguration ) } export { useGraphQL }