@gadmin2n/schematics 0.0.112 → 0.0.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,13 +4,7 @@ import { createRoot } from 'react-dom/client';
|
|
|
4
4
|
import App from './App';
|
|
5
5
|
import './i18n';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
login,
|
|
9
|
-
GAdminTokenName,
|
|
10
|
-
setLoginCookie,
|
|
11
|
-
getUrlParams,
|
|
12
|
-
} from './helpers/login';
|
|
13
|
-
import Cookies from 'js-cookie';
|
|
7
|
+
import { GAdminTokenName, setLoginCookie, getUrlParams } from './helpers/login';
|
|
14
8
|
|
|
15
9
|
// 屏蔽 ECharts 在 RadarChart 多 Y 轴场景下的 alignTicks 噪音警告
|
|
16
10
|
const _warn = console.warn.bind(console);
|
|
@@ -19,22 +13,24 @@ console.warn = (...args: any[]) => {
|
|
|
19
13
|
_warn(...args);
|
|
20
14
|
};
|
|
21
15
|
|
|
22
|
-
// DEV 模式下支持 URL 参数传 token
|
|
16
|
+
// DEV 模式下支持 URL 参数传 token(真跨 host 部署用,例如 portal 子域跳回到分支独立域名)。
|
|
17
|
+
// 同 host 部署时 portal 已通过 httpOnly cookie 完成认证,此处 setLoginCookie 写入会被
|
|
18
|
+
// 浏览器静默拒绝(RFC 6265 §5.3:JS 不可覆盖同名 httpOnly cookie),属于 no-op,无副作用。
|
|
23
19
|
if (import.meta.env.DEV) {
|
|
24
20
|
const params = getUrlParams();
|
|
25
21
|
const gadminToken = params[GAdminTokenName];
|
|
26
22
|
if (gadminToken) setLoginCookie({ gadminToken });
|
|
27
23
|
}
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
// 不再用 `Cookies.get(GAdminTokenName)` 探测:portal 现在用 httpOnly cookie,js 端永远读不到,
|
|
26
|
+
// 否则会陷入"探测失败 → login → callback → 探测仍失败"的死循环。
|
|
27
|
+
// 认证统一交给 authProvider.check()——发 /api/userinfo(同源会自动带 httpOnly cookie),
|
|
28
|
+
// 401 时由 check() 内部的防重入逻辑触发 taihuLogin。
|
|
29
|
+
const container = document.getElementById('root') as HTMLElement;
|
|
30
|
+
const root = createRoot(container);
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
32
|
+
root.render(
|
|
33
|
+
<React.Suspense fallback="loading">
|
|
34
|
+
<App />
|
|
35
|
+
</React.Suspense>,
|
|
36
|
+
);
|