import { useEffect, useState } from 'react'

const useProfile = () => {
    const [data, setData] = useState(false);
    const [loading, setLoading] = useState(true);

    //setup admin page
    useEffect(() => {
        setLoading(true)
        fetch('/api/profile').then(response => {
            response.json().then(data => {
                setData(data);
                setLoading(false)
            });
        })
    }, []);


  return {loading, data}
}

export default useProfile