1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-11 00:08:30 +01:00

fix(react-router): Make sure logout still works.

This commit is contained in:
ivaosthu 2018-08-13 09:54:18 +02:00
parent 8e30022282
commit e7d899f77d
4 changed files with 13 additions and 11 deletions

View File

@ -33,8 +33,9 @@ Array [
"title": "Applications",
},
Object {
"component": [Function],
"icon": "exit_to_app",
"path": "logout",
"path": "/logout",
"title": "Sign out",
},
]
@ -115,8 +116,9 @@ Array [
"title": "Applications",
},
Object {
"component": [Function],
"icon": "exit_to_app",
"path": "logout",
"path": "/logout",
"title": "Sign out",
},
]

View File

@ -10,6 +10,7 @@ import ShowArchive from '../../page/archive/show';
import Archive from '../../page/archive';
import Applications from '../../page/applications';
import ApplicationView from '../../page/applications/view';
import LogoutFeatures from '../../page/user/logout';
export const routes = [
// Features
@ -39,7 +40,7 @@ export const routes = [
{ path: '/applications/:name', title: ':name', parent: '/applications', component: ApplicationView },
{ path: '/applications', title: 'Applications', icon: 'apps', component: Applications },
{ path: 'logout', title: 'Sign out', icon: 'exit_to_app' },
{ path: '/logout', title: 'Sign out', icon: 'exit_to_app', component: LogoutFeatures },
];
export const getRoute = path => routes.find(route => route.path === path);

View File

@ -7,7 +7,6 @@ class SimpleAuthenticationComponent extends React.Component {
authDetails: PropTypes.object.isRequired,
unsecureLogin: PropTypes.func.isRequired,
fetchFeatureToggles: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
};
handleSubmit = evt => {
@ -16,12 +15,7 @@ class SimpleAuthenticationComponent extends React.Component {
const user = { email };
const path = evt.target.action;
this.props
.unsecureLogin(path, user)
.then(this.props.fetchFeatureToggles)
.then(() => {
this.props.history.push('/features');
});
this.props.unsecureLogin(path, user).then(this.props.fetchFeatureToggles);
};
render() {

View File

@ -1,6 +1,11 @@
import React from 'react';
import FeatureListContainer from './../../component/feature/list-container';
import PropTypes from 'prop-types';
const render = () => <FeatureListContainer logout />;
const render = ({ history }) => <FeatureListContainer logout history={history} />;
render.propTypes = {
history: PropTypes.object.isRequired,
};
export default render;