fix: 请求设置默认org_id

This commit is contained in:
Jiangjie.Bai
2022-04-19 20:21:49 +08:00
committed by 老广
parent e5b2bd7008
commit 69e392b069

View File

@@ -7,6 +7,7 @@ import { Message, MessageBox } from 'element-ui'
import store from '@/store'
import axiosRetry from 'axios-retry'
import router from '@/router'
import { DEFAULT_ORG_ID } from '@/utils/org'
// create an axios instance
const service = axios.create({
@@ -22,7 +23,10 @@ function beforeRequestAddToken(config) {
}
const queryOrgId = router.currentRoute.query?.oid
const storeOrgId = store.getters.currentOrg?.id
const orgId = queryOrgId || storeOrgId
let orgId = queryOrgId || storeOrgId
if (!store.getters.publicSettings?.XPACK_ENABLED) {
orgId = DEFAULT_ORG_ID
}
if (orgId) {
config.headers['X-JMS-ORG'] = orgId
}