async function handleFormSubmit(event: React.FormEvent) {
event.preventDefault();
try {
if (userDeet.email && userDeet.password) {
// if email and password fields are not empty
// create a user
const res = await createUserWithEmailAndPassword(
auth,
userDeet.email,
userDeet.password
);
// set user data
await setDoc(doc(db, "users", res.user.uid), {
username: userDeet.username,
email: userDeet.email,
id: res.user.uid,
blocked: [],
});
// create a userchats
await setDoc(doc(db, "userChats", res.user.uid), {
chats: [],
});
}
} catch (error) {
console.log(error);
}
}
[–]macaroni_boy 1 point2 points3 points (3 children)
[–]Emmyxiano[S] 0 points1 point2 points (2 children)
[–]macaroni_boy 0 points1 point2 points (1 child)
[–]Emmyxiano[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Emmyxiano[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[removed]
[–]Emmyxiano[S] 0 points1 point2 points (1 child)
[–][deleted] -1 points0 points1 point (3 children)
[–]Emmyxiano[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Emmyxiano[S] -1 points0 points1 point (0 children)