前端拦截器
作者:互联网
axios.interceptors.request.use( config => { if (localStorage.getItem('token')) { config.headers['token'] = localStorage.getItem('token'); } return config; }, error => { return Promise.reject(error.response); });
标签:拦截器,return,前端,token,localStorage,getItem,error,config 来源: https://www.cnblogs.com/ztlman/p/15977533.html