If i got any 404 error then logging the error in catch block has that status code but if i get an 504 error from server then logging error.response in catch is undefined. Any reason why that happens?
try {
const response = await axios.request({
method,
url,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
...config,
});
return response;
} catch (error) {
console.dir(error);
if (error.response && error.response.status === 401) {
const isNonAuthUrl = window.location.pathname.match(/\/verify\//);
if (!isNonAuthUrl) {
localStorage.clear();
window.location.reload();
} else {
throw error;
}
} else {
throw error;
}
}