mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-09 01:17:06 +02:00
fix: logout should only be called once
This commit is contained in:
parent
217170c2e2
commit
367b5c8d85
@ -332,7 +332,7 @@ export const routes = [
|
|||||||
title: 'Sign out',
|
title: 'Sign out',
|
||||||
icon: 'exit_to_app',
|
icon: 'exit_to_app',
|
||||||
component: LogoutFeatures,
|
component: LogoutFeatures,
|
||||||
type: 'protected',
|
type: 'unprotected',
|
||||||
layout: 'main',
|
layout: 'main',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -3,23 +3,27 @@ import PropTypes from 'prop-types';
|
|||||||
import { Card, CardContent, CardHeader } from '@material-ui/core';
|
import { Card, CardContent, CardHeader } from '@material-ui/core';
|
||||||
import { styles as commonStyles } from '../common';
|
import { styles as commonStyles } from '../common';
|
||||||
|
|
||||||
const LogoutComponent = ({ logoutUser, history }) => {
|
const LogoutComponent = ({ logoutUser, user }) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
logoutUser();
|
if(user) {
|
||||||
});
|
logoutUser();
|
||||||
|
}
|
||||||
|
}, [user, logoutUser]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card shadow={0} className={commonStyles.fullwidth}>
|
<Card shadow={0} className={commonStyles.fullwidth}>
|
||||||
<CardHeader>Logged out</CardHeader>
|
<CardHeader>Logged out</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
You have now been successfully logged out of Unleash. Thank you
|
You have now been successfully logged out of Unleash.
|
||||||
for using Unleash.{' '}
|
<br /> <br />
|
||||||
|
Thank you for using Unleash.{' '}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
LogoutComponent.propTypes = {
|
LogoutComponent.propTypes = {
|
||||||
logoutUser: PropTypes.func.isRequired,
|
logoutUser: PropTypes.func.isRequired,
|
||||||
|
user: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default LogoutComponent;
|
export default LogoutComponent;
|
||||||
|
@ -6,6 +6,8 @@ const mapDispatchToProps = {
|
|||||||
logoutUser,
|
logoutUser,
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = () => ({});
|
const mapStateToProps = (state) => ({
|
||||||
|
user: state.user.get('profile'),
|
||||||
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(LogoutComponent);
|
export default connect(mapStateToProps, mapDispatchToProps)(LogoutComponent);
|
||||||
|
@ -62,6 +62,7 @@ const features = (state = new List([]), action) => {
|
|||||||
return new List(action.featureToggles.map($Map));
|
return new List(action.featureToggles.map($Map));
|
||||||
case USER_LOGIN:
|
case USER_LOGIN:
|
||||||
case USER_LOGOUT:
|
case USER_LOGOUT:
|
||||||
|
console.log('clear toggle store');
|
||||||
debug(USER_LOGOUT, action);
|
debug(USER_LOGOUT, action);
|
||||||
return new List([]);
|
return new List([]);
|
||||||
default:
|
default:
|
||||||
|
@ -17,7 +17,7 @@ const userStore = (state = new $Map({permissions: []}), action) => {
|
|||||||
.set('showDialog', true);
|
.set('showDialog', true);
|
||||||
return state;
|
return state;
|
||||||
case USER_LOGOUT:
|
case USER_LOGOUT:
|
||||||
return new $Map();
|
return new $Map({permissions: []});
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user