This is an automated email from the ASF dual-hosted git repository. liubao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-fence.git
commit 36217a82eabdedbdae3b4d1b7dbb6acb73e21d83 Author: liubao <[email protected]> AuthorDate: Thu Aug 15 16:44:37 2024 +0800 change admin website context --- admin-website/src/main/web/.env | 5 ++--- admin-website/src/main/web/config/vite.config.dev.ts | 15 --------------- admin-website/src/main/web/src/api/interceptor.ts | 8 +------- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/admin-website/src/main/web/.env b/admin-website/src/main/web/.env index 46a2f57..bcd1eed 100644 --- a/admin-website/src/main/web/.env +++ b/admin-website/src/main/web/.env @@ -1,3 +1,2 @@ -VITE_CONTEXT = /ui/admin/web/ -VITE_BASE_API = /api -VITE_SERVER_HOST = http://127.0.0.1:7001 +VITE_CONTEXT = /ui/admin/ + diff --git a/admin-website/src/main/web/config/vite.config.dev.ts b/admin-website/src/main/web/config/vite.config.dev.ts index 951e818..dfb583a 100644 --- a/admin-website/src/main/web/config/vite.config.dev.ts +++ b/admin-website/src/main/web/config/vite.config.dev.ts @@ -2,18 +2,6 @@ import { mergeConfig, loadEnv } from 'vite'; import eslint from 'vite-plugin-eslint'; import baseConfig from './vite.config.base'; -const proxyConfig = { - [loadEnv('', process.cwd()).VITE_BASE_API]: { - target: loadEnv('', process.cwd()).VITE_SERVER_HOST, - changeOrigin: true, - logLevel: 'debug', - rewrite: (path) => - path.replace( - new RegExp(`${loadEnv('', process.cwd()).VITE_BASE_API}`), - '' - ), - }, -}; export default mergeConfig( { mode: 'development', @@ -22,9 +10,6 @@ export default mergeConfig( fs: { strict: true, }, - proxy: { - ...proxyConfig, - }, }, plugins: [ eslint({ diff --git a/admin-website/src/main/web/src/api/interceptor.ts b/admin-website/src/main/web/src/api/interceptor.ts index f1446cd..7867e45 100644 --- a/admin-website/src/main/web/src/api/interceptor.ts +++ b/admin-website/src/main/web/src/api/interceptor.ts @@ -10,21 +10,15 @@ export interface HttpResponse<T = unknown> { data: T; } -const { VITE_API_BASE_URL, VITE_BASE_API, VITE_MOCK_IGNORE } = +const { VITE_API_BASE_URL } = import.meta.env || {}; if (VITE_API_BASE_URL) { axios.defaults.baseURL = VITE_API_BASE_URL; } -const ignoreMockApiList = VITE_MOCK_IGNORE?.split(',') || []; axios.interceptors.request.use( (config: AxiosRequestConfig) => { - const isProxy = ignoreMockApiList.includes(config.url); - if (isProxy) { - config.url = config.url?.replace(VITE_BASE_API, '/api/v1'); - } - const token = getToken(); if (token) { if (!config.headers) {
