diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 0eb9c2df..b53d2029 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -11,27 +11,32 @@ import { Register } from "./pages/Register";
const router = createBrowserRouter([
{
path: "/",
- element: ,
- },
- {
- path: "register",
- element: ,
- },
- {
- path: "login",
- element: ,
- },
- {
- path: "profile-update",
- element: ,
- },
- {
- path: "profile",
- element: ,
- },
- {
- path: "delete-profile",
- element: ,
+ children: [
+ {
+ path: "/",
+ element: ,
+ },
+ {
+ path: "register",
+ element: ,
+ },
+ {
+ path: "login",
+ element: ,
+ },
+ {
+ path: "profile-update",
+ element: ,
+ },
+ {
+ path: "profile",
+ element: ,
+ },
+ {
+ path: "delete-profile",
+ element: ,
+ },
+ ],
},
]);
diff --git a/frontend/src/pages/utils/ProtectedPage.tsx b/frontend/src/pages/utils/ProtectedPage.tsx
index 0e09090a..1d3842d5 100644
--- a/frontend/src/pages/utils/ProtectedPage.tsx
+++ b/frontend/src/pages/utils/ProtectedPage.tsx
@@ -1,15 +1,16 @@
import type { PropsWithChildren } from "react";
-import { Navigate } from "react-router-dom";
import { usePetClinicState } from "../../state";
+import { Login } from "../Login";
+
type ProtectedPageProps = PropsWithChildren;
const ProtectedPage = ({ children }: ProtectedPageProps) => {
const {
auth: { user },
} = usePetClinicState();
- if (!user) {
- return ;
+ if (user) {
+ return <>{children}>;
}
- return <>{children}>;
+ return ;
};
export { ProtectedPage };