From 2e429535ab7d78450943699cd4a06a2e91ea1389 Mon Sep 17 00:00:00 2001 From: Arthur Belleville Date: Thu, 27 Mar 2025 08:59:34 +0100 Subject: [PATCH] Improve ProtectedRoute --- ui/src/App.tsx | 2 +- ui/src/components/ProtectedRoute.tsx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 683b45a..c883797 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -26,7 +26,7 @@ export const App = () => { + } diff --git a/ui/src/components/ProtectedRoute.tsx b/ui/src/components/ProtectedRoute.tsx index 2547719..bb7320a 100644 --- a/ui/src/components/ProtectedRoute.tsx +++ b/ui/src/components/ProtectedRoute.tsx @@ -3,12 +3,13 @@ import { useSession } from "../contexts/SessionContext"; import { Navigate } from "react-router-dom"; interface ProtectedRouteProps { children: ReactNode; + to?: string; } -export const ProtectedRoute = ({ children }: ProtectedRouteProps) => { +export const ProtectedRoute = ({ children, to }: ProtectedRouteProps) => { const { session } = useSession(); if (!session) { - return ; + return ; } // If authenticated, render the protected component