mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
commit
a1177d58ea
@ -9,8 +9,6 @@ import UserStore from '../stores/user_store';
|
||||
import WhitelabelActions from '../actions/whitelabel_actions';
|
||||
import WhitelabelStore from '../stores/whitelabel_store';
|
||||
|
||||
import Alt from '../alt';
|
||||
|
||||
import Nav from 'react-bootstrap/lib/Nav';
|
||||
import Navbar from 'react-bootstrap/lib/Navbar';
|
||||
import CollapsibleNav from 'react-bootstrap/lib/CollapsibleNav';
|
||||
@ -31,7 +29,7 @@ let Header = React.createClass({
|
||||
showAddWork: React.PropTypes.bool
|
||||
},
|
||||
|
||||
mixins: [Router.Navigation, Router.State],
|
||||
mixins: [Router.State],
|
||||
|
||||
getDefaultProps() {
|
||||
return {
|
||||
@ -55,14 +53,6 @@ let Header = React.createClass({
|
||||
WhitelabelStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
handleLogout(){
|
||||
UserActions.logoutCurrentUser();
|
||||
Alt.flush();
|
||||
// kill intercom (with fire)
|
||||
window.Intercom('shutdown');
|
||||
this.transitionTo('login');
|
||||
},
|
||||
|
||||
getLogo(){
|
||||
let logo = (
|
||||
<span>
|
||||
@ -119,7 +109,7 @@ let Header = React.createClass({
|
||||
<DropdownButton eventKey="1" title={this.state.currentUser.username}>
|
||||
<MenuItemLink eventKey="2" to="settings">{getLangText('Account Settings')}</MenuItemLink>
|
||||
<MenuItem divider />
|
||||
<MenuItem eventKey="3" onClick={this.handleLogout}>{getLangText('Log out')}</MenuItem>
|
||||
<MenuItemLink eventKey="3" to="logout">{getLangText('Log out')}</MenuItemLink>
|
||||
</DropdownButton>
|
||||
);
|
||||
|
||||
|
30
js/components/logout_container.js
Normal file
30
js/components/logout_container.js
Normal file
@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Router from 'react-router';
|
||||
|
||||
let Link = Router.Link;
|
||||
import UserActions from '../actions/user_actions';
|
||||
import Alt from '../alt';
|
||||
|
||||
|
||||
let LogoutContainer = React.createClass({
|
||||
|
||||
mixins: [Router.Navigation, Router.State],
|
||||
|
||||
componentDidMount() {
|
||||
UserActions.logoutCurrentUser();
|
||||
Alt.flush();
|
||||
// kill intercom (with fire)
|
||||
window.Intercom('shutdown');
|
||||
this.transitionTo('/');
|
||||
},
|
||||
|
||||
render() {
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
export default LogoutContainer;
|
@ -5,6 +5,7 @@ import Router from 'react-router';
|
||||
|
||||
import Landing from './components/landing';
|
||||
import LoginContainer from './components/login_container';
|
||||
import LogoutContainer from '../../../components/logout_container';
|
||||
import SignupContainer from './components/signup_container';
|
||||
import PasswordResetContainer from '../../../components/password_reset_container';
|
||||
import PrizeRegisterPiece from './components/register_piece';
|
||||
@ -25,6 +26,7 @@ function getRoutes(commonRoutes) {
|
||||
<Route name="app" path={baseUrl} handler={App}>
|
||||
<Route name="landing" path={baseUrl} handler={Landing} />
|
||||
<Route name="login" path="login" handler={LoginContainer} />
|
||||
<Route name="logout" path="logout" handler={LogoutContainer} />
|
||||
<Route name="signup" path="signup" handler={SignupContainer} />
|
||||
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
|
||||
<Route name="register_piece" path="register_piece" handler={PrizeRegisterPiece} />
|
||||
|
@ -11,6 +11,7 @@ import PieceContainer from './components/ascribe_detail/piece_container';
|
||||
import EditionContainer from './components/ascribe_detail/edition_container';
|
||||
|
||||
import LoginContainer from './components/login_container';
|
||||
import LogoutContainer from './components/logout_container';
|
||||
import SignupContainer from './components/signup_container';
|
||||
import PasswordResetContainer from './components/password_reset_container';
|
||||
|
||||
@ -26,6 +27,7 @@ const COMMON_ROUTES = (
|
||||
<Route>
|
||||
<Route name="signup" path="signup" handler={SignupContainer} />
|
||||
<Route name="login" path="login" handler={LoginContainer} />
|
||||
<Route name="logout" path="logout" handler={LogoutContainer} />
|
||||
<Route name="pieces" path="collection" handler={PieceList} />
|
||||
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
|
||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||
|
Loading…
Reference in New Issue
Block a user