Answers for "how to get error code fom catch in axios"

11

axios try catch get error status cocxe

try {
     	await axios.get('/bad-call')
     } catch (error) {
        const err = error as AxiosError
        if (err.response) {
           console.log(err.response.status)
           console.log(err.response.data)
        }
        this.handleAxiosError(error)
     }
Posted by: Guest on May-24-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language