diff --git a/client/coral-framework/actions/auth.js b/client/coral-framework/actions/auth.js index 03ab61c76..79fba460c 100644 --- a/client/coral-framework/actions/auth.js +++ b/client/coral-framework/actions/auth.js @@ -267,8 +267,8 @@ export const fetchForgotPassword = (email) => (dispatch) => { export const logout = () => (dispatch) => { return coralApi('/auth', {method: 'DELETE'}).then(() => { - dispatch({type: actions.LOGOUT}); Storage.removeItem('token'); + dispatch({type: actions.LOGOUT}); }); }; diff --git a/client/coral-settings/containers/ProfileContainer.js b/client/coral-settings/containers/ProfileContainer.js index 04e337b47..84c2c1642 100644 --- a/client/coral-settings/containers/ProfileContainer.js +++ b/client/coral-settings/containers/ProfileContainer.js @@ -25,6 +25,14 @@ class ProfileContainer extends Component { }; } + componentWillReceiveProps(nextProps) { + if (this.props.auth.loggedIn !== nextProps.auth.loggedIn) { + + // Refetch after login/logout. + this.props.data.refetch(); + } + } + handleTabChange = (tab) => { this.setState({ activeTab: tab @@ -39,7 +47,7 @@ class ProfileContainer extends Component { return ; } - if (data.loading) { + if (!me || data.loading) { return ; }