Created
June 5, 2021 09:53
-
-
Save jhonsore/b560c3c282ae45ad1770f039851c7d56 to your computer and use it in GitHub Desktop.
Firebase tips
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
| // Auth an user and create it instantly in users collection | |
| firebase.auth().createUserWithEmailAndPassword(email, password) | |
| .then((userCredential) => { | |
| return firebase.firestore().collection('users').doc(userCredential.user.uid) | |
| .set({ | |
| field1: 'my-field-value', | |
| field2: 'my-field-value' | |
| ); | |
| }) | |
| .then(() => { | |
| // user created | |
| }) | |
| .catch((error) => { | |
| var errorCode = error.code; | |
| var errorMessage = error.message; | |
| // .. | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment