Vue + axios interception timeout login problems

axios.interceptors.request.use(config => config, error => Promise.reject(error));

axios.interceptors.response.use((response) => {
  const status = response.data.statusCode;
  if (status === 'AAM-ER-301' || status === 'AAM-ER-302' || status === 'AAM-ER-303') {
    alert('已超时,请重新登录');
    if (sessionStorage.getItem('isNaigation') === 'yes') {
      window.parent.location.href = '/';
    } else {
      window.location.href = '/';returnElse 
  }
    } response;
}, error => Promise.reject(error));

Reference: https://blog.csdn.net/H1069495874/article/details/80057107  

Guess you like

Origin www.cnblogs.com/arealy/p/11115020.html