"use client"
// app/dashboard/page.tsx
import { redirect } from "next/navigation"
import { useRouter } from "next/navigation";
import { useEffect } from "react";
import { useUser } from "../user-context";

export default function Dashboard() {

    const { isAuthenticated, isLoading, user } = useUser()
    const router = useRouter();

    useEffect(() => {
        if (!isLoading) {
            if (!isAuthenticated) {
                router.push('/login');
                console.log(user?.role)
                return;
            }
        }
    }, [isAuthenticated, isLoading, router, user]);

    return (<></>)

}
