// 获取路由的地址
let pathname = location.pathname;
if(localStorage.getItem('token')){
if(pathname != '/' && pathname != '/login' && pathname != ' ' ){
config.headers.common['token'] = localStorage.getItem('token');
console.log('kk');
}else {
// 不是登陆页面就将 header 为 null
config.headers.common= null ;
}
}
网友评论