Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. const auth = firebase.auth();
  2. const db = firebase.firestore();
  3.  
  4.  
  5. // sign up the user
  6. auth.createUserWithEmailAndPassword(email, password).then((cred) => {
  7. // set admin to true for the only first user
  8. return db.collection('users').doc(cred.user.uid).set({
  9. admin: true
  10. })
  11.  
  12. }).then(() => {
  13. console.log();
  14. }).catch(err => {
  15.  
  16. });
  17.  
  18. const auth = firebase.auth();
  19. const db = firebase.firestore();
  20.  
  21.  
  22. // sign up the user
  23. auth.createUserWithEmailAndPassword(email, password).then((cred) => {
  24. // set admin to true for the only first user
  25. return db.collection('users').doc(cred.user.uid).set({
  26. admin: true
  27. })
  28.  
  29. }).then(() => {
  30. console.log();
  31. }).catch(err => {
  32.  
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement