diff --git a/frontend/src/component/menu/routes.js b/frontend/src/component/menu/routes.js index a30381efa9..c111c14433 100644 --- a/frontend/src/component/menu/routes.js +++ b/frontend/src/component/menu/routes.js @@ -332,7 +332,7 @@ export const routes = [ title: 'Sign out', icon: 'exit_to_app', component: LogoutFeatures, - type: 'protected', + type: 'unprotected', layout: 'main', }, { diff --git a/frontend/src/component/user/logout-component.jsx b/frontend/src/component/user/logout-component.jsx index 2020043f68..bb4855b991 100644 --- a/frontend/src/component/user/logout-component.jsx +++ b/frontend/src/component/user/logout-component.jsx @@ -3,23 +3,27 @@ import PropTypes from 'prop-types'; import { Card, CardContent, CardHeader } from '@material-ui/core'; import { styles as commonStyles } from '../common'; -const LogoutComponent = ({ logoutUser, history }) => { +const LogoutComponent = ({ logoutUser, user }) => { useEffect(() => { - logoutUser(); - }); + if(user) { + logoutUser(); + } + }, [user, logoutUser]); return ( Logged out - You have now been successfully logged out of Unleash. Thank you - for using Unleash.{' '} + You have now been successfully logged out of Unleash. +

+ Thank you for using Unleash.{' '}
); }; LogoutComponent.propTypes = { logoutUser: PropTypes.func.isRequired, + user: PropTypes.object, }; export default LogoutComponent; diff --git a/frontend/src/component/user/logout-container.jsx b/frontend/src/component/user/logout-container.jsx index 115949d841..1e5f79c125 100644 --- a/frontend/src/component/user/logout-container.jsx +++ b/frontend/src/component/user/logout-container.jsx @@ -6,6 +6,8 @@ const mapDispatchToProps = { logoutUser, }; -const mapStateToProps = () => ({}); +const mapStateToProps = (state) => ({ + user: state.user.get('profile'), +}); export default connect(mapStateToProps, mapDispatchToProps)(LogoutComponent); diff --git a/frontend/src/store/feature-toggle/index.js b/frontend/src/store/feature-toggle/index.js index 3881c8a068..30fee69809 100644 --- a/frontend/src/store/feature-toggle/index.js +++ b/frontend/src/store/feature-toggle/index.js @@ -62,6 +62,7 @@ const features = (state = new List([]), action) => { return new List(action.featureToggles.map($Map)); case USER_LOGIN: case USER_LOGOUT: + console.log('clear toggle store'); debug(USER_LOGOUT, action); return new List([]); default: diff --git a/frontend/src/store/user/index.js b/frontend/src/store/user/index.js index 6ccbcc9a6d..8e9214bc3a 100644 --- a/frontend/src/store/user/index.js +++ b/frontend/src/store/user/index.js @@ -17,7 +17,7 @@ const userStore = (state = new $Map({permissions: []}), action) => { .set('showDialog', true); return state; case USER_LOGOUT: - return new $Map(); + return new $Map({permissions: []}); default: return state; }