diff options
Diffstat (limited to 'stepped-solutions/34/frontend')
| -rwxr-xr-x | stepped-solutions/34/frontend/components/PleaseSignIn.js | 22 | ||||
| -rwxr-xr-x | stepped-solutions/34/frontend/pages/sell.js | 12 |
2 files changed, 34 insertions, 0 deletions
diff --git a/stepped-solutions/34/frontend/components/PleaseSignIn.js b/stepped-solutions/34/frontend/components/PleaseSignIn.js new file mode 100755 index 0000000..80cfdbf --- /dev/null +++ b/stepped-solutions/34/frontend/components/PleaseSignIn.js @@ -0,0 +1,22 @@ +import { Query } from 'react-apollo'; +import { CURRENT_USER_QUERY } from './User'; +import Signin from './Signin'; + +const PleaseSignIn = props => ( + <Query query={CURRENT_USER_QUERY}> + {({ data, loading }) => { + if (loading) return <p>Loading...</p>; + if (!data.me) { + return ( + <div> + <p>Please Sign In before Continuing</p> + <Signin /> + </div> + ); + } + return props.children; + }} + </Query> +); + +export default PleaseSignIn; diff --git a/stepped-solutions/34/frontend/pages/sell.js b/stepped-solutions/34/frontend/pages/sell.js new file mode 100755 index 0000000..b60ae80 --- /dev/null +++ b/stepped-solutions/34/frontend/pages/sell.js @@ -0,0 +1,12 @@ +import CreateItem from '../components/CreateItem'; +import PleaseSignIn from '../components/PleaseSignIn'; + +const Sell = props => ( + <div> + <PleaseSignIn> + <CreateItem /> + </PleaseSignIn> + </div> +); + +export default Sell; |
