1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 16:48:04 +02:00
onion/js/components/logout_container.js

40 lines
941 B
JavaScript
Raw Normal View History

2015-07-17 15:02:44 +02:00
'use strict';
import React from 'react';
import { History } from 'react-router';
2015-07-17 15:02:44 +02:00
import UserActions from '../actions/user_actions';
import { alt, altWhitelabel, altUser, altThirdParty } from '../alt';
2015-07-17 15:02:44 +02:00
2015-07-17 18:01:22 +02:00
import AppConstants from '../constants/application_constants';
let baseUrl = AppConstants.baseUrl;
2015-07-17 15:02:44 +02:00
let LogoutContainer = React.createClass({
mixins: [History],
2015-07-17 15:02:44 +02:00
componentDidMount() {
2015-07-17 18:53:04 +02:00
UserActions.logoutCurrentUser()
.then(() => {
alt.flush();
altWhitelabel.flush();
altUser.flush();
altThirdParty.flush();
2015-07-17 18:53:04 +02:00
// kill intercom (with fire)
window.Intercom('shutdown');
this.history.replaceState(null, baseUrl);
2015-07-17 18:53:04 +02:00
})
.catch((err) => {
console.logGlobal(err);
});
2015-07-17 15:02:44 +02:00
},
render() {
return null;
}
});
export default LogoutContainer;