mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
fix(react-router): Make sure logout still works.
This commit is contained in:
parent
8e30022282
commit
e7d899f77d
@ -33,8 +33,9 @@ Array [
|
|||||||
"title": "Applications",
|
"title": "Applications",
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
|
"component": [Function],
|
||||||
"icon": "exit_to_app",
|
"icon": "exit_to_app",
|
||||||
"path": "logout",
|
"path": "/logout",
|
||||||
"title": "Sign out",
|
"title": "Sign out",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@ -115,8 +116,9 @@ Array [
|
|||||||
"title": "Applications",
|
"title": "Applications",
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
|
"component": [Function],
|
||||||
"icon": "exit_to_app",
|
"icon": "exit_to_app",
|
||||||
"path": "logout",
|
"path": "/logout",
|
||||||
"title": "Sign out",
|
"title": "Sign out",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -10,6 +10,7 @@ import ShowArchive from '../../page/archive/show';
|
|||||||
import Archive from '../../page/archive';
|
import Archive from '../../page/archive';
|
||||||
import Applications from '../../page/applications';
|
import Applications from '../../page/applications';
|
||||||
import ApplicationView from '../../page/applications/view';
|
import ApplicationView from '../../page/applications/view';
|
||||||
|
import LogoutFeatures from '../../page/user/logout';
|
||||||
|
|
||||||
export const routes = [
|
export const routes = [
|
||||||
// Features
|
// Features
|
||||||
@ -39,7 +40,7 @@ export const routes = [
|
|||||||
{ path: '/applications/:name', title: ':name', parent: '/applications', component: ApplicationView },
|
{ path: '/applications/:name', title: ':name', parent: '/applications', component: ApplicationView },
|
||||||
{ path: '/applications', title: 'Applications', icon: 'apps', component: Applications },
|
{ 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);
|
export const getRoute = path => routes.find(route => route.path === path);
|
||||||
|
@ -7,7 +7,6 @@ class SimpleAuthenticationComponent extends React.Component {
|
|||||||
authDetails: PropTypes.object.isRequired,
|
authDetails: PropTypes.object.isRequired,
|
||||||
unsecureLogin: PropTypes.func.isRequired,
|
unsecureLogin: PropTypes.func.isRequired,
|
||||||
fetchFeatureToggles: PropTypes.func.isRequired,
|
fetchFeatureToggles: PropTypes.func.isRequired,
|
||||||
history: PropTypes.object.isRequired,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
handleSubmit = evt => {
|
handleSubmit = evt => {
|
||||||
@ -16,12 +15,7 @@ class SimpleAuthenticationComponent extends React.Component {
|
|||||||
const user = { email };
|
const user = { email };
|
||||||
const path = evt.target.action;
|
const path = evt.target.action;
|
||||||
|
|
||||||
this.props
|
this.props.unsecureLogin(path, user).then(this.props.fetchFeatureToggles);
|
||||||
.unsecureLogin(path, user)
|
|
||||||
.then(this.props.fetchFeatureToggles)
|
|
||||||
.then(() => {
|
|
||||||
this.props.history.push('/features');
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import FeatureListContainer from './../../component/feature/list-container';
|
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;
|
export default render;
|
||||||
|
Loading…
Reference in New Issue
Block a user