lundi 16 septembre 2019

If condition doesn't run but else condition works

Im making a login page using firebase. In the error handling part of the authentication when error != null works but the error == null doesnt go into the console.

firebase.auth().signInWithEmailAndPassword(userEmail, userPassword).catch(function(error) {
var errorCode = error.code;
var errorMessage = error.message;

if(errorMessage == null){
  console.log('loginsucess');
}else{
  console.log('error was present');
  //window.alert(errorMessage); 
}

});

error was present will print in the console but loginsucess doesnt even when there is no error.

Aucun commentaire:

Enregistrer un commentaire