콘솔에 다음 오류가 표시됩니다. 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) } })
P粉3453027532024-03-28 11:31:44
추가해 보세요response.message
和 error.response.message
替换为 response.statusText
和 error.response.statusText
.