콘솔에 다음 오류가 표시됩니다. Uncaught (in promise) TypeError: Cannot read property of undef at eval (read 'message'). 이것은 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) } })
추가해 보세요
response.message
和error.response.message
替换为response.statusText
和error.response.statusText
.