feat:接口带上平台token
This commit is contained in:
parent
15ccadbdf3
commit
24e83af589
@ -11,7 +11,22 @@ export default http;
|
|||||||
|
|
||||||
// 添加请求拦截器
|
// 添加请求拦截器
|
||||||
http.interceptors.request.use(
|
http.interceptors.request.use(
|
||||||
(config) => config,
|
(config) => {
|
||||||
|
try {
|
||||||
|
const token =
|
||||||
|
JSON.parse(localStorage.getItem('VWED_AMR调度系统__PRODUCTION__3.7.1__COMMON__LOCAL__KEY__') || '{}')?.value
|
||||||
|
.TOKEN__.value || '';
|
||||||
|
config.headers['x-access-token'] = token;
|
||||||
|
const tenantId =
|
||||||
|
JSON.parse(localStorage.getItem('VWED_AMR调度系统__PRODUCTION__3.7.1__COMMON__LOCAL__KEY__') || '{}')?.value
|
||||||
|
.TENANT_ID.value || '';
|
||||||
|
config.headers['x-tenant-id'] = tenantId;
|
||||||
|
console.log(config);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
},
|
||||||
(error) => Promise.reject(error.message),
|
(error) => Promise.reject(error.message),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user