chore: fix suspense wrapper

This commit is contained in:
Steven 2023-12-28 08:34:06 +08:00
parent 09c195c752
commit 30dca18b79
2 changed files with 30 additions and 10 deletions

View File

@ -0,0 +1,13 @@
import { Suspense } from "react";
import { Outlet } from "react-router-dom";
import Loading from "@/pages/Loading";
function SuspenseWrapper() {
return (
<Suspense fallback={<Loading />}>
<Outlet />
</Suspense>
);
}
export default SuspenseWrapper;

View File

@ -1,6 +1,7 @@
import { lazy } from "react";
import { createBrowserRouter } from "react-router-dom";
import App from "@/App";
import SuspenseWrapper from "@/layouts/SuspenseWrapper";
import { initialGlobalState } from "@/store/module";
import AuthStatusProvider from "./AuthStatusProvider";
@ -36,16 +37,22 @@ const router = createBrowserRouter([
loader: () => initialGlobalStateLoader(),
children: [
{
path: "/auth",
element: <SignIn />,
},
{
path: "/auth/signup",
element: <SignUp />,
},
{
path: "/auth/callback",
element: <AuthCallback />,
path: "/auth/",
element: <SuspenseWrapper />,
children: [
{
path: "",
element: <SignIn />,
},
{
path: "signup",
element: <SignUp />,
},
{
path: "callback",
element: <AuthCallback />,
},
],
},
{
path: "/",