Hey
I want to bring up the topic of a conditional root Page again. I am aware that there have been some topics on this in the past but nothing very recent and I would like some input.
So this is my current solution. isLoggedIn is a boolean variable. This is in my app.component.ts:
export class MyApp {
rootPage: any
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, storage: Storage) {
storage.get("isLoggedIn").then((status) => {
console.log("component logged in?", status)
if(status) {
this.goToTabsPage()
} else{
this.goToLoginPage()
}
});
platform.ready().then(() => {
statusBar.styleDefault();
splashScreen.hide();
});
}
goToTabsPage ( ) {
this.rootPage = "TabsPage"
}
goToLoginPage() {
this.rootPage = "LoginPage"
}
}
This seems to work fine so far, but I am sure there are better/faster ways to do it.