/bexapi 接口调用带iam token鉴权
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
import axios from 'axios'
|
||||
import { APP_TOKEN, getUserToken } from '@/shared/services/iamAuth'
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: '/bexapi',
|
||||
timeout: 10000,
|
||||
})
|
||||
|
||||
// 请求拦截器:为 /bexapi 请求注入 IAM 鉴权头
|
||||
api.interceptors.request.use((config) => {
|
||||
config.headers['digi-middleware-auth-app'] = APP_TOKEN
|
||||
const userToken = getUserToken()
|
||||
if (userToken) {
|
||||
config.headers['digi-middleware-auth-user'] = userToken
|
||||
}
|
||||
return config
|
||||
})
|
||||
|
||||
// 系统参数
|
||||
export const sysParameterApi = {
|
||||
list: () => api.get('/sys-parameters/'),
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ export default defineConfig({
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/bexapi': {
|
||||
target: 'https://bexell-scheduling.dongsk.top',
|
||||
target: 'http://localhost:8003',
|
||||
changeOrigin: true,
|
||||
rewrite: (p) => p.replace(/^\/bexapi/, '/api'),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user