Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. const { email, username, password } = this.state;
  2.  
  3. await firebase
  4. .auth()
  5. .createUserWithEmailAndPassword(email, password)
  6. .then(async user => {
  7. console.log('Data created', user);
  8. let rootRef = firebase.database().ref()
  9.  
  10. rootRef.child("users")
  11. .orderByChild("username")
  12. .equalTo(username)
  13. .once("value")
  14. .then(snapshot => {
  15. if (snapshot.exists()) {
  16. let userData = snapshot.val()
  17. console.log(userData)
  18. Alert.alert('username is taken')
  19. return userData;
  20. }else {
  21. console.log('not found')
  22.  
  23. }
  24. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement