Skip to content

Instantly share code, notes, and snippets.

@shawndeprey
Last active November 13, 2019 21:11
Show Gist options
  • Save shawndeprey/6fbe3aa272c812475acce78d5cdd3caa to your computer and use it in GitHub Desktop.
Save shawndeprey/6fbe3aa272c812475acce78d5cdd3caa to your computer and use it in GitHub Desktop.
Axios configuration for the SPA timeout article
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