Showing
2 changed files
with
7 additions
and
2 deletions
... | @@ -2,8 +2,10 @@ import { useMemo } from "react"; | ... | @@ -2,8 +2,10 @@ import { useMemo } from "react"; |
2 | import { ApolloClient, HttpLink, InMemoryCache } from "@apollo/client"; | 2 | import { ApolloClient, HttpLink, InMemoryCache } from "@apollo/client"; |
3 | import { concatPagination } from "@apollo/client/utilities"; | 3 | import { concatPagination } from "@apollo/client/utilities"; |
4 | import merge from "deepmerge"; | 4 | import merge from "deepmerge"; |
5 | - | ||
6 | export const APOLLO_STATE_PROP_NAME = "__APOLLO_STATE__"; | 5 | export const APOLLO_STATE_PROP_NAME = "__APOLLO_STATE__"; |
6 | +import getConfig from "next/config"; | ||
7 | + | ||
8 | +const { publicRuntimeConfig } = getConfig(); | ||
7 | 9 | ||
8 | let apolloClient: any; | 10 | let apolloClient: any; |
9 | 11 | ||
... | @@ -11,7 +13,7 @@ function createApolloClient() { | ... | @@ -11,7 +13,7 @@ function createApolloClient() { |
11 | return new ApolloClient({ | 13 | return new ApolloClient({ |
12 | ssrMode: typeof window === "undefined", | 14 | ssrMode: typeof window === "undefined", |
13 | link: new HttpLink({ | 15 | link: new HttpLink({ |
14 | - uri: "http://localhost:5000/graphql", // Server URL (must be absolute) | 16 | + uri: publicRuntimeConfig.BACKEND_HOST ?? "http://localhost:5000/graphql", // Server URL (must be absolute) |
15 | credentials: "same-origin", // Additional fetch() options like `credentials` or `headers` | 17 | credentials: "same-origin", // Additional fetch() options like `credentials` or `headers` |
16 | }), | 18 | }), |
17 | cache: new InMemoryCache({ | 19 | cache: new InMemoryCache({ | ... | ... |
-
Please register or login to post a comment