Vue+axios 拦截,超时登录问题


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 = '/';
    }
  } else return response;
}, error => Promise.reject(error));

参考: https://blog.csdn.net/H1069495874/article/details/80057107  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM