When i put an authStateChange and try to set root page accordingly to the user are or arent logged in, the page isnt load instantly, it appear a blank page. But when i resize the browser window the page appears.
I also tried changeDetectorRef, but it causes some bugs in my login form.
This is my app.component code
export class MyApp {
rootPage: any;
constructor(platform: Platform,
statusBar: StatusBar,
splashScreen: SplashScreen,
ionicStorage: Storage,
autenticacao: AutenticacaoProvider,
firebase: AngularFireAuth,
private ref: ChangeDetectorRef) {
platform.ready().then(() => {
statusBar.styleDefault();
splashScreen.hide();
ionicStorage.get('OnboardPage').then((OnboardPage) => {
if (OnboardPage || OnboardPage != null || OnboardPage != undefined) {
let unsubscribe = firebase.auth.onAuthStateChanged((user) => {
if (!user) {
console.log(user);
this.rootPage = 'LoginPage';
unsubscribe()
} else {
console.log('logged', user)
this.rootPage = 'TabsPage';
unsubscribe()
}
});
}
else {
this.rootPage = 'OnboardPage';
}
})
});
}
}
after resizing the window
Can someone help me please ? =/