Skip to content

Commit ba4ce81

Browse files
committed
direct
1 parent b371cee commit ba4ce81

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

index.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@
88
</head>
99
<body>
1010
<div id="root"></div>
11+
<script>
12+
(() => {
13+
const redirectFlag = new URLSearchParams(window.location.search).has(
14+
"redirect"
15+
);
16+
if (!redirectFlag) {
17+
return;
18+
}
19+
20+
const storedPath = sessionStorage.getItem("spa-redirect");
21+
if (!storedPath) {
22+
return;
23+
}
24+
25+
sessionStorage.removeItem("spa-redirect");
26+
const normalizedPath = storedPath.startsWith("/")
27+
? storedPath
28+
: `/${storedPath}`;
29+
const newUrl = window.location.origin + normalizedPath;
30+
window.history.replaceState(null, "", newUrl);
31+
})();
32+
</script>
1133
<script type="module" src="/src/main.jsx"></script>
1234
</body>
1335
</html>

0 commit comments

Comments
 (0)