Currently, I have integrated a login system using Firebase and Ionic 2. My app is based on a Tabs template and I am facing an issue where upon successful login, the user is not redirected to the TabsPage as intended.
Whenever I attempt to navigate using this.navCtrl.push('TabsPage');, it results in a Promise error.
Below is a snippet from my Login.ts file:
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { User } from "../../models/user";
import { AngularFireAuth } from 'angularfire2/auth';
@IonicPage()
@Component({
selector: 'page-login',
templateUrl: 'login.html',
})
export class LoginPage {
user = {} as User;
constructor(private afAuth: AngularFireAuth, public navCtrl:
NavController,
public navParams: NavParams) {
}
async login(user: User){
try{
const result = await this.afAuth.auth.signInWithEmailAndPassword(user.email,
user.password);
if(result){
this.navCtrl.push('TabsPage');
}
}
catch(error){
console.error(error);
}
}
register(){
this.navCtrl.push('RegisterPage');
}
}