Does the axios interceptor return 200 have to enter the then method?

I check whether the 403 status is returned in the interceptor, and if so, jump to the login page
instance.interceptors.response.use (function (response) {
if (response.data.status = = 200) {

.
    return response.data;

} else if (response.data.status = = 403) {/ / user identity expires

    Message.error(response.data.errorMessage);
    router.push({path: "/login"});//
    window.localStorage.removeItem("user");//   

} else {

    Message.error(response.data.errorMessage);

}
},
error = > {

if (error.response) {
    switch (error.response.status) {
       case 400: Message.error(response.error.message); break;
       
    }
}
return Promise.reject(error.response.data)

});
this side can indeed jump to the login page, but still enter the then, how not to enter the then
this.$axios.get ("getInfo")

            .then((response) => {
                
            })
Mar.10,2021

the interceptor encapsulated in our project can see that 200 will enter the first function, but you can judge the status returned by the backend according to the code value
if you return a Promise.reject (res) in an abnormal state, you can capture the catch or handle it uniformly when you request again

/ 
Axios.interceptors.response.use(
  response => {
    const res = response.data
    if (res.code !== '1') {
      Message({
        showClose: true,
        message: res.message,
        type: 'error'
      })
      return Promise.reject(res)
    } else {
      return res
    }
  },
  error => {
    Message({
      message: error.message,
      type: 'error',
      duration: 5000
    })
    // 
    return Promise.reject(error)
  }
)

there should be no such way, unless you change the source code,
can actually add a judgment to then

            .then((response) => {
                if(response){
                    
                }
            })
Menu