代码修改
This commit is contained in:
1 parent
a35ed77ff0
commit
761491ec41
1 file changed
+11
-1
@@ -86,12 +86,22 @@ function AppProviders({ children }: { children: React.ReactNode }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根路由 `/` → `/login` 重定向,**保留 query string**。
|
||||||
|
* 外部系统的任务深链落在 `#/?taskId=...&goPath=...`,裸 `<Navigate to="/login">` 会丢掉
|
||||||
|
* query,导致 LoginPage 读不到参数;这里把 search 一并带过去。
|
||||||
|
*/
|
||||||
|
function RootRedirect() {
|
||||||
|
const { search } = useLocation();
|
||||||
|
return <Navigate to={`/login${search}`} replace />;
|
||||||
|
}
|
||||||
|
|
||||||
export function App() {
|
export function App() {
|
||||||
return (
|
return (
|
||||||
<HashRouter>
|
<HashRouter>
|
||||||
<AppProviders>
|
<AppProviders>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<Navigate to="/login" replace />} />
|
<Route path="/" element={<RootRedirect />} />
|
||||||
<Route path="/login" element={<LoginPage />} />
|
<Route path="/login" element={<LoginPage />} />
|
||||||
<Route path="/login/:username" element={<LoginPage />} />
|
<Route path="/login/:username" element={<LoginPage />} />
|
||||||
<Route path="/landing" element={<LandingPage />} />
|
<Route path="/landing" element={<LandingPage />} />
|
||||||
|
|||||||
Reference in new issue
Block a user