Created
          November 27, 2018 10:44 
        
      - 
      
 - 
        
Save kvnam/13ca024ed6dcb6a2974cd4bb389b8a5d to your computer and use it in GitHub Desktop.  
    ReactPress User signout Action
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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