"use client";

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

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

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

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

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