0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-17 22:04:19 -05:00

fix(console): fix react data router (#3737)

This commit is contained in:
Gao Sun 2023-04-22 22:24:06 +08:00 committed by GitHub
parent b204cf828d
commit 5ef299866d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,4 @@
import { useMemo } from 'react';
import { import {
Route, Route,
RouterProvider, RouterProvider,
@ -19,18 +20,22 @@ import HandleSocialCallback from '../Profile/containers/HandleSocialCallback';
function Main() { function Main() {
const swrOptions = useSwrOptions(); const swrOptions = useSwrOptions();
const router = createBrowserRouter( const router = useMemo(
createRoutesFromElements( () =>
<> createBrowserRouter(
<Route path="callback" element={<Callback />} /> createRoutesFromElements(
<Route path="welcome" element={<Welcome />} /> <>
<Route path="handle-social" element={<HandleSocialCallback />} /> <Route path="callback" element={<Callback />} />
<Route element={<AppContent />}> <Route path="welcome" element={<Welcome />} />
<Route path="/*" element={<ConsoleContent />} /> <Route path="handle-social" element={<HandleSocialCallback />} />
</Route> <Route element={<AppContent />}>
</> <Route path="/*" element={<ConsoleContent />} />
), </Route>
{ basename: getBasename() } </>
),
{ basename: getBasename() }
),
[]
); );
return ( return (