Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
axios interceptor for expired sessions with SweetAlert
axios.interceptors.response.use(response => {
return response;
}, error => {
if (error.response.status === 401) {{
title: 'Session expired',
text: 'Please sign in again!',
type: 'error',
}).then(result => {
if (result.value) {
return Promise.reject(error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment