client/src/components/Navbar.js
changeset 44 3b20e2b584fe
parent 12 48ddaa42b810
child 52 96f8a4a59bd9
--- a/client/src/components/Navbar.js	Thu Jun 15 17:18:22 2017 +0200
+++ b/client/src/components/Navbar.js	Fri Jun 16 18:36:39 2017 +0200
@@ -22,6 +22,13 @@
   }
 
   renderLogin() {
+
+    if (this.props.currentUser) {
+      return (
+        <NavItem>{ this.props.currentUser.username }</NavItem>
+      );
+    }
+
     return (
       <NavItem onClick={this.onClickLogin} href="/login">Login</NavItem>
     );
@@ -55,7 +62,8 @@
 
 function mapStateToProps(state, props) {
   return {
-    isAuthenticated: state.get('isAuthenticated')
+    isAuthenticated: state.get('isAuthenticated'),
+    currentUser: state.get('currentUser'),
   };
 }