Redirect from root to dashboard/login
This commit is contained in:
parent
a38d498961
commit
352172487a
@ -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() {
|
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 />;
|
return <Outlet />;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user