mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
95444b60da
GITHUB_PR_NUMBER: 9048 GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9048 PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6159 Co-authored-by: Amit Kumar Sharma <91947037+amit-ksh@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> GitOrigin-RevId: 0565d8a00c944d72b46bc5ce0ff40fc3e8bfca51
28 lines
802 B
JavaScript
28 lines
802 B
JavaScript
import withApollo from "next-with-apollo";
|
|
import { ApolloClient, ApolloProvider, InMemoryCache } from "@apollo/client";
|
|
|
|
// Learn more about `@apollo/client` here - https://www.apollographql.com/docs/react/why-apollo
|
|
// Learn more about `next-with-apollo` here - https://github.com/lfades/next-with-apollo
|
|
|
|
// creating the Apollo Client
|
|
const client = new ApolloClient({
|
|
uri: process.env.NEXT_PUBLIC_HASURA_APP_URL, // <- Configure GraphQL Server URL (must be absolute)
|
|
cache: new InMemoryCache()
|
|
});
|
|
|
|
export default withApollo(
|
|
() => {
|
|
return client;
|
|
},
|
|
{
|
|
// providing the Apollo Client access to the pages
|
|
render: ({ Page, props }) => {
|
|
return (
|
|
<ApolloProvider client={props.apollo}>
|
|
<Page {...props} />
|
|
</ApolloProvider>
|
|
);
|
|
}
|
|
}
|
|
);
|