mirror of
https://gitee.com/bootx/dax-pay-ui.git
synced 2025-09-09 13:40:06 +00:00
16 lines
355 B
TypeScript
16 lines
355 B
TypeScript
type ProxyItem = [string, string];
|
|
|
|
type ProxyList = ProxyItem[];
|
|
|
|
export function createProxy(list: ProxyList = []) {
|
|
const ret: any = {};
|
|
for (const [prefix, target] of list) {
|
|
ret[prefix] = {
|
|
target: target,
|
|
changeOrigin: true,
|
|
rewrite: (path: string) => path.replace(new RegExp(`^${prefix}`), ''),
|
|
};
|
|
}
|
|
return ret;
|
|
}
|