import useUserStore from '@/stores/UserStore';
import { usePage } from '@inertiajs/react';
import { useEffect } from 'react';

const AuthUser = () => {
    const { auth } = usePage().props;
    const { user, fetchUser } = useUserStore();

    useEffect(() => {
        if (auth.user) {
            if (user == null) {
                fetchUser();
            }
        }
    }, [auth.user]);
};

export default AuthUser;
