Redirect from root to dashboard/login

This commit is contained in:
april 2024-01-08 10:28:06 -06:00
parent a38d498961
commit 352172487a

View File

@ -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 <Outlet />;
}