From 13b4dcbbe8b02ebbc18d2ad58f4a5abad82c4bee Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Sat, 19 Nov 2016 12:54:24 +0200 Subject: [PATCH] #48: reset oauthData on logo click --- src/components/auth/actions.js | 7 +++++++ src/pages/root/RootPage.jsx | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/auth/actions.js b/src/components/auth/actions.js index 5642904..d9823b3 100644 --- a/src/components/auth/actions.js +++ b/src/components/auth/actions.js @@ -231,6 +231,13 @@ export function setClient({id, name, description}) { }; } +export function resetOAuth() { + return (dispatch) => { + localStorage.removeItem('oauthData'); + dispatch(setOAuthRequest({})); + }; +} + export const SET_OAUTH = 'set_oauth'; export function setOAuthRequest(oauth) { return { diff --git a/src/pages/root/RootPage.jsx b/src/pages/root/RootPage.jsx index a335f5d..1d2f2a4 100644 --- a/src/pages/root/RootPage.jsx +++ b/src/pages/root/RootPage.jsx @@ -31,7 +31,7 @@ function RootPage(props) { })}>
- +
@@ -57,12 +57,16 @@ RootPage.propTypes = { pathname: PropTypes.string }).isRequired, children: PropTypes.element, + resetOAuth: PropTypes.func.isRequired, isPopupActive: PropTypes.bool.isRequired }; import { connect } from 'react-redux'; +import { resetOAuth } from 'components/auth/actions'; export default connect((state) => ({ user: state.user, isPopupActive: state.popup.popups.length > 0 -}))(RootPage); +}), { + resetOAuth +})(RootPage);