diff --git a/frontend/src/component/menu/__tests__/__snapshots__/routes-test.jsx.snap b/frontend/src/component/menu/__tests__/__snapshots__/routes-test.jsx.snap index cf94282c9c..0820089161 100644 --- a/frontend/src/component/menu/__tests__/__snapshots__/routes-test.jsx.snap +++ b/frontend/src/component/menu/__tests__/__snapshots__/routes-test.jsx.snap @@ -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", }, ] diff --git a/frontend/src/component/menu/routes.js b/frontend/src/component/menu/routes.js index 1a5acac0d5..4854810352 100644 --- a/frontend/src/component/menu/routes.js +++ b/frontend/src/component/menu/routes.js @@ -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); diff --git a/frontend/src/component/user/authentication-simple-component.jsx b/frontend/src/component/user/authentication-simple-component.jsx index ad1dbd4d04..d00a5f3959 100644 --- a/frontend/src/component/user/authentication-simple-component.jsx +++ b/frontend/src/component/user/authentication-simple-component.jsx @@ -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() { diff --git a/frontend/src/page/user/logout.js b/frontend/src/page/user/logout.js index d2b3217548..710ea681cd 100644 --- a/frontend/src/page/user/logout.js +++ b/frontend/src/page/user/logout.js @@ -1,6 +1,11 @@ import React from 'react'; import FeatureListContainer from './../../component/feature/list-container'; +import PropTypes from 'prop-types'; -const render = () => ; +const render = ({ history }) => ; + +render.propTypes = { + history: PropTypes.object.isRequired, +}; export default render;