-
I have problem with
Here is my custom const App = ({ Component, pageProps, apollo }) => {
return (
<ApolloProvider client={apollo}>
<Component {...pageProps} />
</ApolloProvider>
)
}
const API_URL =
process.env.NODE_ENV === "development"
? "http://localhost/wordpress/index.php?graphql"
: "https://page/index.php?graphql"
export default withApollo(({ initialState }) => {
return new ApolloClient({
link: new createHttpLink({
uri: API_URL,
fetch: fetch
}),
cache: new InMemoryCache()
})
})(App, { getDataFromTree }) And here is how I call Coupons.getInitialProps = async function() {
const res = await fetch('http://localhost:8000/data/');
const data = await res.json();
console.log(`Data fetched. Count: ${data.length}`);
return {
shows: data.map(entry => entry.show)
};
}; Also. Pages where I have |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Problem was fixed by following https://github.com/zeit/next.js/tree/canary/examples/with-apollo |
Beta Was this translation helpful? Give feedback.
Problem was fixed by following https://github.com/zeit/next.js/tree/canary/examples/with-apollo