|
|
@@ -25,6 +25,7 @@ const urlPrefix = globSetting.urlPrefix || '';
|
|
|
import router from '@/router';
|
|
|
import { storage } from '@/utils/Storage';
|
|
|
import { getRedirectUrl } from '@/utils/getRedirectUrl';
|
|
|
+import { useTargetTenantIdSetting } from '@/utils/useTargetTenantIdSetting';
|
|
|
|
|
|
/**
|
|
|
* @description: 数据处理,方便区分多种处理方式
|
|
|
@@ -205,9 +206,10 @@ const transform: AxiosTransform = {
|
|
|
requestInterceptors: (config, options) => {
|
|
|
// 请求之前处理config
|
|
|
const userStore = useUserStoreWidthOut();
|
|
|
+ const { getValue } = useTargetTenantIdSetting();
|
|
|
const token = userStore.getToken;
|
|
|
const tenantId = userStore.getTenantId;
|
|
|
- const targetTenantId = localStorage.getItem('targetTenantId');
|
|
|
+ const targetTenantId = getValue();
|
|
|
if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
|
|
|
// jwt token
|
|
|
(config as Recordable).headers.satoken = options.authenticationScheme
|
|
|
@@ -325,7 +327,8 @@ export const http = createAxios();
|
|
|
/** 生成所需要的headers */
|
|
|
export const getHeaders = () => {
|
|
|
const userStore = useUserStore();
|
|
|
- const localTId = localStorage.getItem('targetTenantId');
|
|
|
+ const { getValue } = useTargetTenantIdSetting();
|
|
|
+ const localTId = getValue();
|
|
|
const baseHeaders = {
|
|
|
Satoken: userStore.getToken,
|
|
|
Tenantid: userStore.getTenantId,
|
|
|
@@ -333,7 +336,7 @@ export const getHeaders = () => {
|
|
|
if (localTId) {
|
|
|
return {
|
|
|
...baseHeaders,
|
|
|
- targetTenantId: localStorage.getItem('targetTenantId') || '',
|
|
|
+ targetTenantId: localTId,
|
|
|
};
|
|
|
}
|
|
|
return baseHeaders;
|