Uncaught (in promise): false

Viewed 4098

I have the following error when using alert messages for my login menu:

Runtime Error Uncaught (in promise): false Stack Error: Uncaught (in promise): false

This is the code:

  public login() {
    this.showLoading()
    this.auth.login(this.Login).subscribe(allowed => {
      if (allowed) {        
        //this.navCtrl.setRoot('Inicio');
        this.usuarioLogueado = this.auth.getUserInfo();
        if(this.usuarioLogueado.tipo == "Administrador"){
          this.navCtrl.setRoot(Administrador);
        }
        console.log("bienvenido",this.usuarioLogueado.usuario,this.usuarioLogueado.tipo);
      } else {
        this.showError("Acceso denegado");
      }
    },
      error => {
        this.showError(error);
      });
  }

  showLoading() {
    this.loading = this.loadingCtrl.create({
      content: 'Por favor espere...',
      dismissOnPageChange: true
    });
    this.loading.present().then(() => this.loading.dismiss());
  }

  showError(text) {
this.loading.dismiss().catch(() => console.log('ERROR: Control de loading fallo'));
    let alert = this.alertCtrl.create({
      title: 'Fallo',
      subTitle: text,
      buttons: ['OK']
    });
    alert.present(prompt);
  }


}
1 Answers
Related