"use client";

import { useRouter } from "next/navigation";
import { useEffect } from "react";
import { PageLoader } from "@/components/ui";
import { useAuth } from "@/lib/auth";

export default function Home() {
  const router = useRouter();
  const { booting, isAuthed } = useAuth();
  useEffect(() => {
    if (booting) return;
    router.replace(isAuthed ? "/dashboard" : "/login");
  }, [booting, isAuthed, router]);
  return <PageLoader />;
}
