diff --git a/web/app/routes/_index.tsx b/web/app/routes/_index.tsx index a67e866..a29a2bb 100644 --- a/web/app/routes/_index.tsx +++ b/web/app/routes/_index.tsx @@ -1,5 +1,18 @@ -import { Outlet } from "@remix-run/react"; +import { useAuth } from "@/util/auth"; +import { Outlet, useNavigate } from "@remix-run/react"; +import { useEffect } from "react"; export default function Tailfin() { + const { user, loading } = useAuth(); + const navigate = useNavigate(); + + useEffect(() => { + if (!loading && !user) { + navigate("/login"); + } else { + navigate("/logbook"); + } + }, [user, loading, navigate]); + return ; }