Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 1.17 KB

readme.md

File metadata and controls

30 lines (24 loc) · 1.17 KB

deep-foundation react-hasura

npm version example develop deep-foundation

usage

import providers and hooks

import { TokenProvider, useTokenController } from '@deep-foundation/deeplinks/imports/react-token';
import { ApolloClientTokenizedProvider } from '@deep-foundation/react-hasura/apollo-client-tokenized-provider';

control token

const [token, setToken] = useTokenController();
// you can use any token source after it

wrap page

// example from envs
export const GRAPHQL_PATH = `${process.env.NEXT_PUBLIC_HASURA_PATH}/v1/graphql`;
export const GRAPHQL_SSL = !!+process.env.NEXT_PUBLIC_HASURA_SSL;

return <TokenProvider>
  <ApolloClientTokenizedProvider options={{ client: 'app-name', path: GRAPHQL_PATH, ssl: !!GRAPHQL_SSL, ws: !!process?.browser }}>
    {children}
  </ApolloClientTokenizedProvider>
</TokenProvider>;