Skip to content

Instantly share code, notes, and snippets.

@EhsanHadid
Last active February 23, 2023 09:30
Show Gist options
  • Save EhsanHadid/d1926577c1fba0640b2d597ed8d4fce5 to your computer and use it in GitHub Desktop.
Save EhsanHadid/d1926577c1fba0640b2d597ed8d4fce5 to your computer and use it in GitHub Desktop.
register the user info and link account
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