diff --git a/client/coral-admin/src/actions/auth.js b/client/coral-admin/src/actions/auth.js index c2f3a8056..6762bd70a 100644 --- a/client/coral-admin/src/actions/auth.js +++ b/client/coral-admin/src/actions/auth.js @@ -28,7 +28,7 @@ const logOutFailure = () => ({type: actions.LOGOUT_FAILURE}); export const logout = () => dispatch => { dispatch(logOutRequest()); - coralApi('/auth', {method: 'DELETE'}) + return coralApi('/auth', {method: 'DELETE'}) .then(() => dispatch(logOutSuccess())) .catch(error => dispatch(logOutFailure(error))); }; diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index ac9c09eac..d44c44086 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -116,7 +116,7 @@ class Embed extends Component { {lang.t('profile')} Configure Stream - {loggedIn && } + {loggedIn && this.props.logout().then(refetch)} changeTab={this.changeTab}/>} { openStream @@ -157,7 +157,10 @@ class Embed extends Component { :

{asset.settings.closedMessage}

} - {!loggedIn && } + {!loggedIn && } {loggedIn && user && } ({type: actions.FETCH_SIGNIN_FAILURE, error}); export const fetchSignIn = (formData) => (dispatch) => { dispatch(signInRequest()); - coralApi('/auth/local', {method: 'POST', body: formData}) + return coralApi('/auth/local', {method: 'POST', body: formData}) .then(({user}) => { const isAdmin = !!user.roles.filter(i => i === 'ADMIN').length; dispatch(signInSuccess(user, isAdmin)); @@ -148,7 +148,7 @@ const logOutFailure = () => ({type: actions.LOGOUT_FAILURE}); export const logout = () => dispatch => { dispatch(logOutRequest()); - coralApi('/auth', {method: 'DELETE'}) + return coralApi('/auth', {method: 'DELETE'}) .then(() => dispatch(logOutSuccess())) .catch(error => dispatch(logOutFailure(error))); }; diff --git a/client/coral-sign-in/containers/SignInContainer.js b/client/coral-sign-in/containers/SignInContainer.js index fd9762ee3..0ef2b42b4 100644 --- a/client/coral-sign-in/containers/SignInContainer.js +++ b/client/coral-sign-in/containers/SignInContainer.js @@ -147,7 +147,8 @@ class SignInContainer extends Component { handleSignIn(e) { e.preventDefault(); - this.props.fetchSignIn(this.state.formData); + this.props.fetchSignIn(this.state.formData) + .then(this.props.refetch); } render() {