Set different tabs after login


#1

hello, how to set different tabs after login, i use if statement but not work…

this.storage.get(‘hasLoggedIn’).then((value) => {
if(value === true){
this.rootPage = TabsPage;
}else{
this.rootPage = MenuPage;
}
})


#2

“not work” is not very descriptive. Describe exactly what you expect to see and what you are actually seeing.


#3

sory for my english, i have 2 tabs ( TabsPage; + Menupage;), i want change tabs after login but not change … thanks…

this.storage.get(‘hasSeenTutorial’)
.then((hasSeenTutorial) => {

    if (hasSeenTutorial) {

        this.storage.get('hasLoggedIn').then((value) => {

        if(value === true){
            this.rootPage =  TabsPage;
        }else{
      
            this.rootPage = MenuPage;
        }
     })


    } else {
      this.rootPage = TutorialPage;
    }
        this.platformReady()
  })

#4

Asynchronous JavaScript can be somewhat confusing. When you call something that returns a Promise, like this.storage.get('hasLoggedIn'), absolutely the only place that you can rely on that value is in the then clause.


#5

maybe it can help, I modified from https://github.com/driftyco/ionic-conference-app/blob/master/src/app/app.component.ts, I would like to add new tabs to tab after user login, before login then appear TabPage , after user login will appear to tabmenu,


#6

Add some logging. Where/when is it going wrong with what values.


#7

i have 3 page ( home, login + dashboard) on home page i have make tab.page(tab 1), on login page tab.page(hidden) after login goto dashboardpage then show tab.menu(tab 2) + sidebar… but after user login on dashboard tab1 not change to tab2, thanks…