From e704f01538c3d55731a41c426f6e8b5d2c5b02c5 Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Mon, 25 Sep 2023 16:15:29 +0800 Subject: [PATCH] chore: axios whit gateway --- src/api/panel/index.js | 2 +- src/main.js | 2 +- src/utils/request.js | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/api/panel/index.js b/src/api/panel/index.js index 3e59358..31f1a7d 100644 --- a/src/api/panel/index.js +++ b/src/api/panel/index.js @@ -86,7 +86,7 @@ export function listCondition (query) { // 查询监听器列表 export function listListener (query) { return request({ - url: '/workflow/extension/listener/list', + url: 'workflow_proxy/workflow/extension/listener/list', method: 'get', params: query }) diff --git a/src/main.js b/src/main.js index 7e03d6a..92c425f 100644 --- a/src/main.js +++ b/src/main.js @@ -10,7 +10,6 @@ import { useMicroAppStoreWithOut } from './store/modules/microApp' import { createPinia } from 'pinia' import { isEmpty } from 'lodash-es' const store = createPinia() - let instance = null function render(props = {}) { const { container, mountApp } = props @@ -22,6 +21,7 @@ function render(props = {}) { // fixme: 开发阶段使用,生产环境可以注释掉 if (!window.__POWERED_BY_QIANKUN__) { + window.$glob.ticket = '5607c923-5cfe-4950-b375-b72a28a1d5b8' bootstrap().then(() => render()) } diff --git a/src/utils/request.js b/src/utils/request.js index fae71a7..d9d24d6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -2,21 +2,20 @@ import axios from 'axios' import qs from 'qs' import { checkUrl } from './index' window.$glob = { - url: '', - params: {}, + url: process.env.VUE_APP_BASE_API, + ticket: '', query: {}, header: {} } -// 认证方案:使用token进行请求 -window.$glob.params.token && -(window.$glob.header['Authorization'] = `Bearer ${window.$glob.params.token}`) axios.defaults.timeout = 30000 axios.defaults.validateStatus = function (status) { return status >= 200 && status <= 500 } - axios.interceptors.request.use(config => { if (!checkUrl(config.url)) config.url = window.$glob.url + config.url + // 认证方案:使用Bearer + window.$glob.ticket && + (config.headers['Authorization'] = `Bearer ${window.$glob.ticket}`) let header = window.$glob.header || {} config.headers = Object.assign(config.headers, header) let data = window.$glob.query || {}