diff --git a/js/components/header.js b/js/components/header.js index af2171bf..f899def8 100644 --- a/js/components/header.js +++ b/js/components/header.js @@ -10,8 +10,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'; @@ -32,7 +30,7 @@ let Header = React.createClass({ showAddWork: React.PropTypes.bool }, - mixins: [Router.Navigation, Router.State], + mixins: [Router.State], getDefaultProps() { return { @@ -56,14 +54,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 = ( @@ -120,7 +110,7 @@ let Header = React.createClass({ {getLangText('Account Settings')} - {getLangText('Log out')} + {getLangText('Log out')} ); diff --git a/js/components/logout_container.js b/js/components/logout_container.js new file mode 100644 index 00000000..713cac7c --- /dev/null +++ b/js/components/logout_container.js @@ -0,0 +1,32 @@ +'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'; + +import AppConstants from '../constants/application_constants'; +let baseUrl = AppConstants.baseUrl; + +let LogoutContainer = React.createClass({ + + mixins: [Router.Navigation, Router.State], + + componentDidMount() { + UserActions.logoutCurrentUser(); + Alt.flush(); + // kill intercom (with fire) + window.Intercom('shutdown'); + this.transitionTo(baseUrl); + }, + + render() { + return null; + } + +}); + + +export default LogoutContainer; diff --git a/js/components/whitelabel/prize/routes.js b/js/components/whitelabel/prize/routes.js index 9821fc79..72513419 100644 --- a/js/components/whitelabel/prize/routes.js +++ b/js/components/whitelabel/prize/routes.js @@ -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) { + diff --git a/js/routes.js b/js/routes.js index 8b038372..90248ef2 100644 --- a/js/routes.js +++ b/js/routes.js @@ -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 = ( +