diff --git a/src/components/Modals/SignUp.tsx b/src/components/Modals/SignUp.tsx index 705c7ac..aa690bd 100644 --- a/src/components/Modals/SignUp.tsx +++ b/src/components/Modals/SignUp.tsx @@ -4,7 +4,7 @@ import { useEffect, useState } from 'react' import { useRouter } from 'next/router' import { useCreateUserWithEmailAndPassword } from 'react-firebase-hooks/auth' import { auth, firestore } from '@/firebase/firebase' -// import { doc, setDoc } from "firebase/firestore"; +import { doc, setDoc } from 'firebase/firestore' import { toast } from 'react-toastify' type SignUpProps = {} @@ -29,18 +29,18 @@ const SignUp: React.FC = () => { const newUser = await createUserWithEmailAndPassword(inputs.email, inputs.password) if (!newUser) return console.log(newUser) - // const userData = { - // uid: newUser.user.uid, - // email: newUser.user.email, - // displayName: inputs.displayName, - // createdAt: Date.now(), - // updatedAt: Date.now(), - // likedProblems: [], - // dislikedProblems: [], - // solvedProblems: [], - // starredProblems: [], - // }; - // await setDoc(doc(firestore, "users", newUser.user.uid), userData); + const userData = { + uid: newUser.user.uid, + email: newUser.user.email, + displayName: inputs.displayName, + createdAt: Date.now(), + updatedAt: Date.now(), + likedProblems: [], + dislikedProblems: [], + solvedProblems: [], + starredProblems: [], + } + await setDoc(doc(firestore, 'users', newUser.user.uid), userData) router.push('/') } catch (error: any) { toast.error(error.message, { position: 'top-center' })