Fix error page for root routes

This commit is contained in:
Jonathan
2025-06-13 23:32:06 +02:00
committed by Bryan Frimin
parent 9f94603b3a
commit 32744e603d

View File

@@ -29,13 +29,17 @@ import { dataRoutes } from "./routes/dataRoutes.ts";
import { assetRoutes } from "./routes/assetRoutes.ts";
import { lazy } from "@probo/react-lazy";
function ErrorBoundary() {
const error = useRouteError();
/**
* Top level error boundary
*/
function ErrorBoundary({ error: propsError }: { error?: string }) {
const error = useRouteError() ?? propsError;
if (error instanceof UnAuthenticatedError) {
return <Navigate to="/auth/login" />;
}
return <div>error</div>;
return <PageError error={error?.toString()} />;
}
export type AppRoute = {
@@ -78,7 +82,9 @@ const routes = [
},
{
path: "documents/signing-requests",
Component: lazy(() => import("./pages/DocumentSigningRequestsPage.tsx")),
Component: lazy(
() => import("./pages/DocumentSigningRequestsPage.tsx")
),
},
],
},
@@ -118,6 +124,11 @@ const routes = [
},
],
},
// Fallback URL to the NotFound Page
{
path: "*",
Component: PageError,
},
] satisfies AppRoute[];
/**