I have next code:
import axios, {AxiosError} from "axios";
try {
some request
} catch(err:AxiosError) {
console.log(error.response) //doesnt work
console.log(error.response?.data?.message) //doesnt work
if(error.response?.data?.statusCode === 401) {
logout()
}
}
I cannot check status code inside bacause of typescript how to describe the error type correctly without resorting to the any type? I couldn't find how people handle this error in typescript, maybe I'm missing something