summaryrefslogtreecommitdiffstats
path: root/frontend/components/PleaseSignIn.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-04-05 13:54:22 -0400
committerWes Bos <wesbos@gmail.com>2018-04-05 13:54:22 -0400
commitf4f10d5eb690a33dd1c112358457a2b987297f26 (patch)
treed97326763dd016c13a068fb7dee40fc0b9667f83 /frontend/components/PleaseSignIn.js
parenta75b2491758a451283e2a373bb3fbe886520b345 (diff)
work
Diffstat (limited to 'frontend/components/PleaseSignIn.js')
-rw-r--r--frontend/components/PleaseSignIn.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/frontend/components/PleaseSignIn.js b/frontend/components/PleaseSignIn.js
new file mode 100644
index 0000000..bd96842
--- /dev/null
+++ b/frontend/components/PleaseSignIn.js
@@ -0,0 +1,21 @@
+import { Query } from 'react-apollo';
+import { CURRENT_USER_QUERY } from '../queries/index';
+import Signin from './Signin';
+
+const PleaseSignIn = props => (
+ <Query query={CURRENT_USER_QUERY}>
+ {({ data }) => {
+ if (data.me) {
+ return props.children;
+ }
+ return (
+ <div>
+ <p>Please sign in before continuing!</p>
+ <Signin />
+ </div>
+ );
+ }}
+ </Query>
+);
+
+export default PleaseSignIn;