"use client";

import SitesPage from "./SitesPage";
import Loading from "@/components/Loading";

import { useEffect } from "react";
import useAuth from "@/hooks/useAuth";

export default function Dashboard() {
  const { loading, username, name, validate } = useAuth();

  useEffect(() => {
    const runValidation = async () => {
    await validate();
  };
    
    runValidation();
  }, [validate]);

  if (loading) {
    return <Loading />;
  } else {
    return <SitesPage username={username} name={name} />;
  }
}