Last active
February 23, 2023 09:30
-
-
Save EhsanHadid/d1926577c1fba0640b2d597ed8d4fce5 to your computer and use it in GitHub Desktop.
register the user info and link account
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const user = useUser(); | |
const registerFormHandler = async ({ fullname, password }) => { | |
if (user && user.phoneNumber) { | |
const email = convertPhoneToEmail(user.phoneNumber); | |
const credential = EmailAuthProvider.credential(email, password); | |
const userCred = await linkWithCredential(user, credential); | |
await updateProfile(userCred.user, { | |
displayName: fullname, | |
}); | |
await signOut(auth); | |
registered(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment