If you have to use axios and need to catch 401 errors (unauthorized) and redirect to login but want to redirect back: simply route an inertia request to the current url and it will handle routing to login and set intended in the session
.catch(errors => {
if (errors.response && errors.response.status === 401) {
this.$inertia.get(window.location)
}
})
Top comments (0)