- 博客(2)
- 资源 (2)
- 收藏
- 关注
原创 拦截器 添加请求头 响应拦截器
import axios from 'axios'; axios.defaults.baseURL = "http://timemeetyou.com:8889/api/private/v1/"; axios.interceptors.request.use( config => { config.headers.Authorization = window.sessionStorage.getItem("Token"); return config; }); axios.inte
2022-01-06 14:04:33
688
原创 全局前置守卫--路由拦截
/ 全局前置守卫 ---> 进行路由拦截 router.beforeEach( (to, from, next) => { if(to.path == "/login") return next(); const TOKEN = window.sessionStorage.getItem('Token'); if(!TOKEN) { return next({path: '/login'}) } next(); }) ...
2022-01-06 13:52:05
606
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人