axios使用全局拦截器在请求头部添加token
用户登录成功后,后台会返回一个token,在之后发送的请求headers都要带上这个token,否则后台进行授权校验,如果token一致,则允许访问,否则请求不成功被拦截。请求拦截器使用说明:https://github.com/axios/axiosaxios Interceptors requests or responses before they are handled by then or catch(响应和请求)。// Add a request interceptoraxios.interceptors.request.use(function (config) {
继续阅读