equal
deleted
inserted
replaced
20 e.preventDefault(); |
20 e.preventDefault(); |
21 this.props.history.push('/login'); |
21 this.props.history.push('/login'); |
22 } |
22 } |
23 |
23 |
24 renderLogin() { |
24 renderLogin() { |
|
25 |
|
26 if (this.props.currentUser) { |
|
27 return ( |
|
28 <NavItem>{ this.props.currentUser.username }</NavItem> |
|
29 ); |
|
30 } |
|
31 |
25 return ( |
32 return ( |
26 <NavItem onClick={this.onClickLogin} href="/login">Login</NavItem> |
33 <NavItem onClick={this.onClickLogin} href="/login">Login</NavItem> |
27 ); |
34 ); |
28 } |
35 } |
29 |
36 |
53 isAuthenticated: PropTypes.bool.isRequired |
60 isAuthenticated: PropTypes.bool.isRequired |
54 }; |
61 }; |
55 |
62 |
56 function mapStateToProps(state, props) { |
63 function mapStateToProps(state, props) { |
57 return { |
64 return { |
58 isAuthenticated: state.get('isAuthenticated') |
65 isAuthenticated: state.get('isAuthenticated'), |
|
66 currentUser: state.get('currentUser'), |
59 }; |
67 }; |
60 } |
68 } |
61 |
69 |
62 export default connect(mapStateToProps)(AppNavbar); |
70 export default connect(mapStateToProps)(AppNavbar); |