mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-03 14:42:18 +00:00
0.0.6
- Fix hitting dashboard when logged out - Clean up app.js
This commit is contained in:
parent
2f8aa2e502
commit
0c56281bcd
7 changed files with 40 additions and 46 deletions
|
@ -30,10 +30,11 @@ class Navigation extends Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.toggleNavbar = this.toggleNavbar.bind(this);
|
||||
this.handleLogout = this.handleLogout.bind(this);
|
||||
|
||||
// Yeah I know you might not hit home.. but I can't get the
|
||||
// path based finder thing working on initial load :sweatsmile:
|
||||
this.state = { active: "Home", collapsed: true};
|
||||
this.state = { active: "Home", collapsed: true };
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
@ -55,13 +56,16 @@ class Navigation extends Component {
|
|||
|
||||
componentWillUnmount() {
|
||||
eventBus.remove(LOGIN_SUCCESS);
|
||||
eventBus.remove(LOGOUT);
|
||||
}
|
||||
|
||||
_handleClick(menuItem) {
|
||||
this.setState({ active: menuItem, collapsed: !this.state.collapsed });
|
||||
}
|
||||
|
||||
handleLogout() {
|
||||
this.dispatch(logout());
|
||||
}
|
||||
|
||||
toggleNavbar() {
|
||||
this.setState({ collapsed: !this.state.collapsed });
|
||||
}
|
||||
|
@ -94,7 +98,7 @@ class Navigation extends Component {
|
|||
onClick={this._handleClick.bind(this, "profile")}
|
||||
className="navLinkMobile"
|
||||
>Profile</Link>
|
||||
<Link to="/" className="navLink" onClick={logout()}>Logout</Link>
|
||||
<Link to="/" className="navLink" onClick={this.handleLogout}>Logout</Link>
|
||||
</Nav>
|
||||
: <Nav className="navLinkLoginMobile" navbar>
|
||||
{menuItems.map(menuItem =>
|
||||
|
@ -172,7 +176,7 @@ class Navigation extends Component {
|
|||
onClick={this._handleClick.bind(this, "profile")}
|
||||
className="navLink"
|
||||
>Profile</Link>
|
||||
<Link to="/" className="navLink" onClick={logout()}>Logout</Link>
|
||||
<Link to="/" className="navLink" onClick={this.handleLogout}>Logout</Link>
|
||||
</div>
|
||||
:
|
||||
<div className="navLinkLogin">
|
||||
|
@ -209,8 +213,9 @@ class Navigation extends Component {
|
|||
|
||||
function mapStateToProps(state) {
|
||||
const { isLoggedIn } = state.auth;
|
||||
|
||||
return {
|
||||
isLoggedIn,
|
||||
isLoggedIn
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue