mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Implement loggedOut routings
This commit is contained in:
parent
471d95977e
commit
b4f9c11c16
@ -6,27 +6,19 @@ import { History } from 'react-router';
|
||||
import UserActions from '../actions/user_actions';
|
||||
import { alt, altWhitelabel, altUser, altThirdParty } from '../alt';
|
||||
|
||||
import AppConstants from '../constants/application_constants';
|
||||
let baseUrl = AppConstants.baseUrl;
|
||||
|
||||
let LogoutContainer = React.createClass({
|
||||
|
||||
mixins: [History],
|
||||
|
||||
componentDidMount() {
|
||||
UserActions.logoutCurrentUser()
|
||||
.then(() => {
|
||||
alt.flush();
|
||||
altWhitelabel.flush();
|
||||
altUser.flush();
|
||||
altThirdParty.flush();
|
||||
// kill intercom (with fire)
|
||||
window.Intercom('shutdown');
|
||||
this.history.replaceState(null, baseUrl);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.logGlobal(err);
|
||||
});
|
||||
UserActions.logoutCurrentUser();
|
||||
alt.flush();
|
||||
altWhitelabel.flush();
|
||||
altUser.flush();
|
||||
altThirdParty.flush();
|
||||
// kill intercom (with fire)
|
||||
window.Intercom('shutdown');
|
||||
},
|
||||
|
||||
render() {
|
||||
|
@ -13,6 +13,10 @@ import { getLangText } from '../utils/lang_utils';
|
||||
|
||||
|
||||
let PasswordResetContainer = React.createClass({
|
||||
propTypes: {
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return {isRequested: false};
|
||||
},
|
||||
@ -22,12 +26,14 @@ let PasswordResetContainer = React.createClass({
|
||||
},
|
||||
|
||||
render() {
|
||||
if (this.props.query.email && this.props.query.token) {
|
||||
let { location } = this.props;
|
||||
|
||||
if (location.query.email && location.query.token) {
|
||||
return (
|
||||
<div>
|
||||
<PasswordResetForm
|
||||
email={this.props.query.email}
|
||||
token={this.props.query.token}/>
|
||||
email={location.query.email}
|
||||
token={location.query.token}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -3,9 +3,6 @@
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import Col from 'react-bootstrap/lib/Col';
|
||||
import Row from 'react-bootstrap/lib/Row';
|
||||
|
||||
import WhitelabelActions from '../actions/whitelabel_actions';
|
||||
import WhitelabelStore from '../stores/whitelabel_store';
|
||||
|
||||
@ -20,10 +17,6 @@ import GlobalNotificationActions from '../actions/global_notification_actions';
|
||||
import PropertyCollapsible from './ascribe_forms/property_collapsible';
|
||||
import RegisterPieceForm from './ascribe_forms/form_register_piece';
|
||||
|
||||
import LoginContainer from './login_container';
|
||||
import SlidesContainer from './ascribe_slides_container/slides_container';
|
||||
|
||||
|
||||
import { mergeOptions } from '../utils/general_utils';
|
||||
import { getLangText } from '../utils/lang_utils';
|
||||
|
||||
|
31
js/routes.js
31
js/routes.js
@ -44,14 +44,33 @@ let COMMON_ROUTES = (
|
||||
path="login"
|
||||
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||
component={LoginContainer} />
|
||||
<Route path="register_piece" component={RegisterPiece} headerTitle="+ NEW WORK" />
|
||||
<Route path="signup" component={SignupContainer} />
|
||||
<Route path="logout" component={LogoutContainer} />
|
||||
<ProxyRoute
|
||||
path="register_piece"
|
||||
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||
component={RegisterPiece}
|
||||
headerTitle="+ NEW WORK"/>
|
||||
<ProxyRoute
|
||||
path="signup"
|
||||
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||
component={SignupContainer} />
|
||||
<ProxyRoute
|
||||
path="logout"
|
||||
proxyHandler={RedirectProxyHandler({to: '/', when: 'loggedOut'})}
|
||||
component={LogoutContainer}/>
|
||||
<Route path="pieces/:pieceId" component={PieceContainer} />
|
||||
<Route path="editions/:editionId" component={EditionContainer} />
|
||||
<Route path="password_reset" component={PasswordResetContainer} />
|
||||
<Route path="settings" component={SettingsContainer} />
|
||||
<Route path="contract_settings" component={ContractSettings} />
|
||||
<ProxyRoute
|
||||
path="password_reset"
|
||||
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
||||
component={PasswordResetContainer} />
|
||||
<ProxyRoute
|
||||
path="settings"
|
||||
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||
component={SettingsContainer}/>
|
||||
<ProxyRoute
|
||||
path="contract_settings"
|
||||
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
||||
component={ContractSettings}/>
|
||||
<Route path="coa_verify" component={CoaVerifyContainer} />
|
||||
<Route path="*" component={ErrorNotFoundPage} />
|
||||
</Route>
|
||||
|
Loading…
Reference in New Issue
Block a user