diff --git a/src/Managing.WebApp/src/components/mollecules/LogIn/LogIn.tsx b/src/Managing.WebApp/src/components/mollecules/LogIn/LogIn.tsx index efa9b09..98a796c 100644 --- a/src/Managing.WebApp/src/components/mollecules/LogIn/LogIn.tsx +++ b/src/Managing.WebApp/src/components/mollecules/LogIn/LogIn.tsx @@ -2,30 +2,25 @@ import {StatusOfflineIcon} from '@heroicons/react/solid' import type {SubmitHandler} from 'react-hook-form' import {useForm} from 'react-hook-form' import {usePrivy, useSignMessage} from '@privy-io/react-auth' -import {useEffect} from 'react' import useApiUrlStore from '../../../app/store/apiStore' import {UserClient} from '../../../generated/ManagingApi' -import type {ILoginFormInput} from '../../../global/type' +import type {ILoginFormInput} from '../../../global/type.tsx' import useCookie from '../../../hooks/useCookie' import {SecondaryNavbar} from '../NavBar/NavBar' import Toast from '../Toast/Toast' const LogIn = () => { const { apiUrl } = useApiUrlStore() - const { register, handleSubmit, setValue } = useForm() const { user, logout, ready, authenticated } = usePrivy() const { signMessage } = useSignMessage() const { setCookie } = useCookie() - - // Prefill the name field with the Privy DID when user is available - useEffect(() => { - if (user?.id) { - console.log(user) - - setValue('name', user.id) + + const { register, handleSubmit } = useForm({ + defaultValues: { + name: user?.id || '' } - }, [user?.id, setValue]) + }) const onSubmit: SubmitHandler = async (form) => { if (!authenticated || !user || !user.wallet?.address) { @@ -116,6 +111,7 @@ const LogIn = () => {