Мое требование - мне нужно проверить правильное имя пользователя и ПАРОЛЬ, если оно верное, то получить информацию о конкретном пользователе, после получения данных мне нужно перейти на другую страницу, ниже приведен код, пожалуйста, помогите позвонить:
validateFirebase = (email, pass) => {
firebase
.auth()
.signInWithEmailAndPassword("xxxx@gmail.com", "123456")
.then(user => {
const { currentUser } = firebase.auth();
this.setState({ currentUser });
//alert(currentUser)
let u_ref = currentUser.uid;
console.log(u_ref);
let userEmail = currentUser.email;
console.log(userEmail);
firebase
.database()
.ref("users_ids/0")
.once("value")
.then(function(snapshot) {
snapshot.forEach(function(childSnapshot) {
var key = childSnapshot.key;
var childData = childSnapshot.val();
if (key == u_ref) {
role = childData.role;
console.log("hgghgh" + role);
this.props.navigation.navigate("driverloginScreen");
}
});
})
.catch(function(error) {});
})
.catch(function(error) {});
};