Skip to content

Commit

Permalink
Implemented logging out.
Browse files Browse the repository at this point in the history
  • Loading branch information
kallaspriit committed Aug 11, 2016
1 parent a73f793 commit d79e3c8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions views/DevicesView.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import List from 'material-ui/List/List';
import ListItem from 'material-ui/List/ListItem';
import CompareArrows from 'material-ui/svg-icons/action/compare-arrows';
import MenuItem from 'material-ui/MenuItem';
import Divider from 'material-ui/Divider';

import HeaderComponent from './components/HeaderComponent';
import AsyncComponent from './components/AsyncComponent';
Expand All @@ -18,6 +19,7 @@ class DevicesView extends Component {
devices: PropTypes.object.isRequired,

getDevices: PropTypes.func.isRequired,
logout: PropTypes.func.isRequired,
};

componentWillMount() {
Expand Down Expand Up @@ -62,12 +64,20 @@ class DevicesView extends Component {
renderHeaderMenus() {
return [
<MenuItem key={1} onTouchTap={() => this.handleRefresh()}>Refresh</MenuItem>,
<Divider key={2} />,
<MenuItem key={3} onTouchTap={() => this.handleLogout()}>Logout</MenuItem>,
];
}

handleRefresh() {
this.props.getDevices();
}

handleLogout() {
this.props.logout();

browserHistory.replace('/authentication');
}
}

export default connect(
Expand Down

0 comments on commit d79e3c8

Please sign in to comment.