chore: api request
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user