From b50da5917654afcfc20ff71658505b5826870423 Mon Sep 17 00:00:00 2001
From: Jules Laplace <jules@okfoc.us>
Date: Mon, 20 Mar 2017 04:54:05 +0100
Subject: log in and out without reloading

---
 client/components/App.jsx | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'client/components/App.jsx')

diff --git a/client/components/App.jsx b/client/components/App.jsx
index 046ce72..eafd309 100644
--- a/client/components/App.jsx
+++ b/client/components/App.jsx
@@ -12,6 +12,7 @@ export default class App extends React.Component {
       loggedIn: false,
       user: {},
     }
+    this.didAuthenticate = this.didAuthenticate.bind(this)
     client.authenticate()
       .then(user => {
         this.setState({
@@ -25,6 +26,13 @@ export default class App extends React.Component {
         console.error(error)
       })
   }
+  didAuthenticate(user) {
+    console.log(user)
+    this.setState({
+      user: user,
+      loggedIn: true,
+    })
+  }
   logOut() {
     this.setState({
       user: null,
@@ -40,7 +48,7 @@ export default class App extends React.Component {
       }
       else {
         return (
-          <LoggedOutView />
+          <LoggedOutView didAuthenticate={this.didAuthenticate} />
         )
       }
     }
-- 
cgit v1.2.3-70-g09d2

