import useAuth from '@/core/hooks/useAuth' import addressApi from '@/lib/address/api/addressApi' import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline' import { useEffect, useState } from 'react' import { useForm } from 'react-hook-form' const PersonalProfile = () => { const auth = useAuth() const [isOpen, setIsOpen] = useState(false) const toggle = () => setIsOpen(!isOpen) const { register, setValue } = useForm({ defaultValues: { email: '', name: '', mobile: '', password: '' } }) useEffect(() => { const loadProfile = async () => { const dataProfile = await addressApi({ id: auth.partnerId }) setValue('email', dataProfile?.email) setValue('name', dataProfile?.name) setValue('mobile', dataProfile?.mobile) } if (auth) loadProfile() }, [auth, setValue]) return ( <> {isOpen && (
)} > ) } export default PersonalProfile