接口前缀调整
This commit is contained in:
@@ -9,7 +9,14 @@ import axios, {
|
||||
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
|
||||
import qs from 'qs'
|
||||
import { config } from '@/config/axios/config'
|
||||
import { getAccessToken, getRefreshToken, getTenantId, removeToken, setToken } from '@/utils/auth'
|
||||
import {
|
||||
getAccessToken,
|
||||
getRefreshToken,
|
||||
getTenantId,
|
||||
getAppId,
|
||||
removeToken,
|
||||
setToken
|
||||
} from '@/utils/auth'
|
||||
import errorCode from './errorCode'
|
||||
|
||||
import { resetRouter } from '@/router'
|
||||
@@ -58,6 +65,13 @@ service.interceptors.request.use(
|
||||
if (tenantId) {
|
||||
;(config as Recordable).headers['tenant-id'] = tenantId
|
||||
}
|
||||
|
||||
// 设置实例
|
||||
const appId = getAppId()
|
||||
if (appId) {
|
||||
;(config as Recordable).headers['instance-id'] = appId
|
||||
}
|
||||
|
||||
const params = config.params || {}
|
||||
const data = config.data || false
|
||||
if (
|
||||
@@ -225,12 +239,15 @@ const handleAuthorized = () => {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const { wsCache } = useCache()
|
||||
const tenantId = wsCache.get('TENANT_ID')
|
||||
const appId = wsCache.get('App_ID')
|
||||
resetRouter() // 重置静态路由表
|
||||
wsCache.clear()
|
||||
removeToken()
|
||||
isRelogin.show = false
|
||||
// 干掉token后再走一次路由让它过router.beforeEach的校验
|
||||
window.location.href = window.location.href
|
||||
// window.location.href = window.location.href
|
||||
window.location.href = `/login?tenantId=${tenantId}&appId=${appId}`
|
||||
})
|
||||
}
|
||||
return Promise.reject(t('sys.api.timeoutMessage'))
|
||||
|
||||
Reference in New Issue
Block a user