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) => {
})