- 通过axios请求拦截器添加token,保证拥有获取数据的权限
axios.interceptors.request.use(config => {
console.log(config)
config.headers.Authorization = window.sessionStorage.getItem("token")
return config;
}, )
具体看项目规定每次请求头需要什么字段来确定并让获取在登录接口存储的token来保证那些需要权限的API可以调用