I am getting this error on console: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'message') at eval. This is my code in axios.js:
axiosIns.interceptors.response.use(
response => {
if (response.message === 'Unauthenticated') {
window.location = '/login'
}
return response
},
error => {
if (error.response.message === 'Unauthenticated') {
window.location = '/login'
} else if (error.response.status === 401) {
removeUserData()
return Promise.reject(error)
}
})
error.response.messagemust actually beerror.message. I think. Have to know about the API response to be 100% sure. - adibro500/loginroute. Please try to check thePreserve Logoption in the network tab and try. - adibro500