summaryrefslogtreecommitdiffstats
path: root/frontend/pages
diff options
context:
space:
mode:
authorLuis Alvarez <luisito453@gmail.com>2018-05-15 14:35:34 -0500
committerLuis Alvarez <luisito453@gmail.com>2018-05-15 14:35:34 -0500
commit81f4f870294d1641bd33aea5b08cf66e37e376e8 (patch)
tree1593609b86c963ca12da02e2f6b561b44b95baeb /frontend/pages
parenta2f7c511badb6da1f1b7812ea4636ee82a9feb3d (diff)
Added a custom render in _app
Diffstat (limited to 'frontend/pages')
-rw-r--r--frontend/pages/_app.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/frontend/pages/_app.js b/frontend/pages/_app.js
index ccbc3ae..38c72c3 100644
--- a/frontend/pages/_app.js
+++ b/frontend/pages/_app.js
@@ -1,12 +1,14 @@
-import { ApolloApp } from 'next-with-apollo';
+import App, { Container } from 'next/app';
+import { ApolloProvider } from 'react-apollo';
import withData from '../lib/withData';
import { CURRENT_USER_QUERY } from '../queries/queries.graphql';
+import Page from '../components/Page';
// Next.js wraps each Page in an <App></App> component. This is handy for when you want to persist anything from page to page, or just access a component that is 1 level higher than each page.
-// normall here you import App from next/app, but we use next-with-apollo's ApolloApp here so we can get SSR
+// here we use App from next/app and wrap it with withData so we can get Apollo and SSR
-class MyApp extends ApolloApp {
+class MyApp extends App {
componentDidMount() {
if (typeof window !== 'undefined' && !window.__CLIENTLOADED__) {
console.log('Refetching current user');
@@ -25,6 +27,17 @@ class MyApp extends ApolloApp {
return { pageProps };
}
+ render() {
+ const { Component, pageProps, apollo } = this.props;
+
+ return (
+ <Container>
+ <ApolloProvider client={apollo}>
+ <Component {...pageProps} />
+ </ApolloProvider>
+ </Container>
+ );
+ }
}
export default withData(MyApp);