"use client";

import { useProfile } from '@/hooks/auth/useProfile';
import { useAuthStore } from '@/zustand/authStore';
import React, { useEffect } from 'react'

type Props = object

function ProfileIndex({ }: Props) {
    const isAuthenticated = useAuthStore((state) => state.isAuthenticated);

    const { mutate, data, isPending } = useProfile();

    useEffect(() => {
        if (isAuthenticated) {
            mutate();
        }
    }, [isAuthenticated])

    return (
        <div>
            {isPending && 'Loading...'}
            <br />
            {data && JSON.stringify(data)}
        </div>
    )
}

export default ProfileIndex