FixYou
0
Q:

axios get status code

     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)
     }
10
axios.get('/foo')
  .catch(function (error) {
    if (error.response) {
      console.log(error.response.data);
      console.log(error.response.status);
      console.log(error.response.headers);
    }
  });
1
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
1

New to Communities?

Join the community