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;
}
