refactor(projects): 请求适配器函数范型重构、优化请求相关的命名

This commit is contained in:
Soybean
2022-07-28 13:19:50 +08:00
parent 02992dc02d
commit 7f9c98ab8d
11 changed files with 77 additions and 54 deletions

View File

@ -9,10 +9,15 @@ export function createViteProxy(isOpenProxy: boolean, envConfig: ServiceEnvConfi
if (!isOpenProxy) return undefined;
const proxy: Record<string, string | ProxyOptions> = {
[envConfig.proxy]: {
[envConfig.pattern]: {
target: envConfig.url,
changeOrigin: true,
rewrite: path => path.replace(new RegExp(`^${envConfig.proxy}`), '')
rewrite: path => path.replace(new RegExp(`^${envConfig.pattern}`), '')
},
[envConfig.pattern]: {
target: envConfig.secondUrl,
changeOrigin: true,
rewrite: path => path.replace(new RegExp(`^${envConfig.pattern}`), '')
}
};