Files
grademaxxing/app/routes/home.tsx
2026-01-17 13:37:57 +01:00

19 lines
414 B
TypeScript

import { useEffect } from "react";
import { useNavigate } from "react-router";
import { api } from "~/api/client";
export default function Home() {
const navigate = useNavigate();
useEffect(() => {
// Redirect to dashboard if authenticated, otherwise to login
if (api.isAuthenticated()) {
navigate("/dashboard");
} else {
navigate("/login");
}
}, [navigate]);
return null;
}