mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-27 15:30:37 +05:30
Completly reset all auth state on header logo click
This commit is contained in:
parent
a1c713236a
commit
cfcfe39bb7
@ -286,6 +286,18 @@ export function resetOAuth() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets all temporary state related to auth
|
||||||
|
*
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
export function resetAuth() {
|
||||||
|
return (dispatch) => {
|
||||||
|
dispatch(setLogin(null));
|
||||||
|
dispatch(resetOAuth({}));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export const SET_OAUTH = 'set_oauth';
|
export const SET_OAUTH = 'set_oauth';
|
||||||
export function setOAuthRequest(oauth) {
|
export function setOAuthRequest(oauth) {
|
||||||
return {
|
return {
|
||||||
|
@ -31,7 +31,7 @@ function RootPage(props) {
|
|||||||
})}>
|
})}>
|
||||||
<div className={styles.header}>
|
<div className={styles.header}>
|
||||||
<div className={styles.headerContent}>
|
<div className={styles.headerContent}>
|
||||||
<Link to="/" className={styles.logo} onClick={props.resetOAuth}>
|
<Link to="/" className={styles.logo} onClick={props.resetAuth}>
|
||||||
<Message {...messages.siteName} />
|
<Message {...messages.siteName} />
|
||||||
</Link>
|
</Link>
|
||||||
<div className={styles.userbar}>
|
<div className={styles.userbar}>
|
||||||
@ -57,16 +57,16 @@ RootPage.propTypes = {
|
|||||||
pathname: PropTypes.string
|
pathname: PropTypes.string
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
children: PropTypes.element,
|
children: PropTypes.element,
|
||||||
resetOAuth: PropTypes.func.isRequired,
|
resetAuth: PropTypes.func.isRequired,
|
||||||
isPopupActive: PropTypes.bool.isRequired
|
isPopupActive: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { resetOAuth } from 'components/auth/actions';
|
import { resetAuth } from 'components/auth/actions';
|
||||||
|
|
||||||
export default connect((state) => ({
|
export default connect((state) => ({
|
||||||
user: state.user,
|
user: state.user,
|
||||||
isPopupActive: state.popup.popups.length > 0
|
isPopupActive: state.popup.popups.length > 0
|
||||||
}), {
|
}), {
|
||||||
resetOAuth
|
resetAuth
|
||||||
})(RootPage);
|
})(RootPage);
|
||||||
|
Loading…
Reference in New Issue
Block a user