--- 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'),
};
}