remove a ts-ignore and change it to a more reasonable way.

pangu
PeterAlbus 1 year ago
parent 1f701c40ec
commit fe44252b20

@ -29,9 +29,8 @@ axios.defaults.baseURL='https://www.peteralbus.com:8089/'
axios.interceptors.request.use( axios.interceptors.request.use(
config => { config => {
if (localStorage.getItem("token")) { //判断token是否存在 if (localStorage.getItem("token") && config.headers ) { //判断token是否存在
// @ts-ignore config.headers['satoken_peteralbus_blog'] = localStorage.getItem("token")||''; //将token设置成请求头
config.headers.satoken_peteralbus_blog = localStorage.getItem("token"); //将token设置成请求头
} }
return config; return config;
}, },

Loading…
Cancel
Save