| 12345678910111213141516171819 |
- import { bootstrapApplication } from '@angular/platform-browser';
- import { appConfig } from './app/app.config';
- import { App } from './app/app';
- import { PlatformProxyService } from './app/core/api/platform-proxy.service';
- /*
- * 🔴 启动前先探测平台代理(CORS 兼容层,见 `platform-proxy.service.ts`)。
- *
- * 平台 `/api/**` 的响应偶尔带两行 `Access-Control-Allow-Origin`,浏览器直接拦掉
- * 登录与全部云函数调用。探测到 `/api-platform/**` 可用就统一走同源代理,
- * 探不到(代理未部署)就原样直连 —— **探测失败不影响启动**。
- */
- const proxy = new PlatformProxyService();
- const ready = proxy.probe().catch(() => false);
- ready
- .catch(() => false)
- .then(() => bootstrapApplication(App, appConfig))
- .catch((err) => console.error(err));
|