Skip to content

Instantly share code, notes, and snippets.

@kvnam
Created November 27, 2018 10:44
Show Gist options
  • Save kvnam/13ca024ed6dcb6a2974cd4bb389b8a5d to your computer and use it in GitHub Desktop.
Save kvnam/13ca024ed6dcb6a2974cd4bb389b8a5d to your computer and use it in GitHub Desktop.
ReactPress User signout Action
export const userSignout = (token) => {
return dispatch => {
axios.post("/simple-jwt-authentication/v1/token/revoke", {}, {headers: {"Authorization": "Bearer " + token}}).then(response => {
//Clear local storage
localStorage.removeItem("token");
localStorage.removeItem("email");
dispatch({type: actionTypes.USER_SIGNOUT_SUCCESS});
}).catch(err => {
dispatch({type: actionTypes.USER_SIGNOUT_FAIL, error: err});
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment