How to get the returned Status Code 404 status codes in axios

cannot get the returned Status Code 404 status codes in the response interceptor

in main.js

// 
axios.interceptors.request.use(function (config) {
  config.headers["X-Requested-With"] = "XMLHttpRequest"
  console.log(config);
  // 
  return config;
}, function (error) {
  console.log(error);
  // 
  return Promise.reject(error);
});

// 
axios.interceptors.response.use(function (response) {
  console.log(response);
  // 
  return response;
}, function (error) {
  console.log(error.response.status);
  // 
  return Promise.reject(error);
});

request:

    this.$http.get("/url").then(function(res){
          console.log(res)
        }).catch(function(err){
          console.log(err.response)
        })
Oct.22,2021

The response interceptor in

axios can get

   

Menu