(feature): login error toast

This commit is contained in:
Maksym Sadovnychyy 2025-11-20 19:39:46 +01:00
parent 67af5584fb
commit 18c5f72cf2

View File

@ -75,16 +75,17 @@ axiosInstance.interceptors.response.use(
error => {
// Handle response error
store.dispatch(hideLoader())
if (error.response) {
const contentType = error.response.headers['content-type']
if (contentType && contentType.includes('application/problem+json')) {
const problem = error.response.data as ProblemDetails
addToast(`${problem.title}: ${problem.detail}`, 'error')
if (error.response.status === 401) {
// Handle unauthorized error (e.g., redirect to login)
}
}
else if (error.response.status === 401) {
const problem = error.response.data as ProblemDetails
addToast(`${problem.title}: ${problem.detail}`, 'error')
}
}
return Promise.reject(error)