add tenant to all request header

This commit is contained in:
ailanyin
2023-05-11 17:19:05 +08:00
parent 685f1527e5
commit 11b23ec129
5 changed files with 17 additions and 6 deletions

View File

@ -29,6 +29,9 @@ service.interceptors.request.use(config => {
if (getToken() && !isToken) {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
if(useUserStore().tenant){
config.headers['tenant'] = useUserStore().tenant
}
// get请求映射params参数
if (config.method === 'get' && config.params) {
let url = config.url + '?' + tansParams(config.params);