From d22616d5a675f5a381c741784333151255713b45 Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Fri, 6 Apr 2018 16:44:50 -0400 Subject: local data with apollo --- frontend/components/Page.js | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'frontend/components/Page.js') diff --git a/frontend/components/Page.js b/frontend/components/Page.js index 031536b..3c6e3b1 100644 --- a/frontend/components/Page.js +++ b/frontend/components/Page.js @@ -3,8 +3,8 @@ import styled, { ThemeProvider, injectGlobal } from 'styled-components'; import PropTypes from 'prop-types'; import Header from './Header'; import Meta from './Meta'; -import { UIProvider } from './UIContext'; -// Global Style +import { client } from '../lib/withData'; +import { CURRENT_USER_QUERY } from '../queries'; const theme = { red: '#FF0000', @@ -50,17 +50,24 @@ const StyledPage = styled.div` background: white; `; -const Page = ({ children }) => ( - - - - -
- {children} - - - -); +class Page extends React.Component { + componentDidMount() { + // console.log('ComponentDidMount'); + // When the page loads, re-refetch the current user query + // client.query({ query: CURRENT_USER_QUERY, fetchPolicy: 'network-only' }); + } + render() { + return ( + + + +
+ {this.props.children} + + + ); + } +} Page.propTypes = { children: PropTypes.node.isRequired, }; -- cgit v1.3