Last active
November 13, 2019 21:11
-
-
Save shawndeprey/6fbe3aa272c812475acce78d5cdd3caa to your computer and use it in GitHub Desktop.
Axios configuration for the SPA timeout article
This file contains 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
axios.interceptors.response.use( | |
function(response) { | |
return response | |
}, | |
function(error) { | |
return new Promise((resolve, reject) => { | |
if (error && error.response && error.response.status === 440) { | |
// Replace the following 2 lines to match 1) How you store your sessions in your vue app and 2) your signin/login route. | |
store.dispatch("auth/destroySession") | |
router.replace("signin") | |
} | |
reject(error) | |
}) | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment