chore: api request

This commit is contained in:
jialin
2024-06-10 21:14:37 +08:00
parent 6a60561401
commit f491b5dfb1
24 changed files with 685 additions and 312 deletions
+7
View File
@@ -1,7 +1,14 @@
import { defineConfig } from '@umijs/max';
import proxy from './proxy';
import routes from './routes';
const { REACT_APP_ENV = 'dev' } = process.env;
console.log('env+++++++++++++++', process.env.NODE_ENV, REACT_APP_ENV);
export default defineConfig({
proxy: {
...proxy()
},
clickToComponent: {},
antd: {
style: 'less',
+23
View File
@@ -0,0 +1,23 @@
const proxyTableList = ['cli', 'v1'];
// @ts-ingore
export default function createProxyTable(target?: string) {
const proxyTable = proxyTableList.reduce(
(obj: Record<string, object>, api) => {
const newTarget = target || 'http://localhost';
obj[`/${api}/`] = {
target: newTarget,
changeOrigin: true,
secure: false,
ws: true,
pathRewrite: (pth: string) => pth.replace(`/^/${api}/`, `/${api}`),
headers: {
origin: newTarget
}
};
return obj;
},
{}
);
return proxyTable;
}