204ba7b4 by renchao@pashanhoo.com

style:cas

1 parent 1f60e8e5
......@@ -2,7 +2,7 @@
/*
* @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器
* @Autor: renchao
* @LastEditTime: 2023-06-12 17:22:35
* @LastEditTime: 2023-06-13 09:28:21
*/
import axios from 'axios'
import Router from '@/router'
......@@ -34,6 +34,14 @@ service.interceptors.request.use(
} else {
config.headers.delete('Authorization')
}
} else {
const token = Cookies.get('token')
// 添加请求头
if (token) {
config.headers['Authorization'] = 'Bearer ' + token
} else {
config.headers.delete('Authorization')
}
}
return config
},
......