I have been modifying the conference app to learn ionic 3 and am having trouble with the logout button the side menu and it’s actions.
When a user presses logout I want them to be logged out and redirected to the tutorial again, but nothing I have tried works:
openPage(page: PageInterface) {
let params = {};
// the nav component was found using @ViewChild(Nav)
// setRoot on the nav to remove previous pages and only have this page
// we wouldn't want the back button to show in this scenario
if (page.index) {
params = { tabIndex: page.index };
}
// If we are already on tabs just change the selected tab
// don't setRoot again, this maintains the history stack of the
// tabs even if changing them from the menu
if (this.nav.getActiveChildNav() && page.index != undefined) {
this.nav.getActiveChildNav().select(page.index);
// Set the root of the nav with params if it's a tab index
} else {
this.nav.setRoot(page.name, params).catch((err: any) => {
console.log(`Didn't set nav root: ${err}`);
});
}
if (page.logsOut === true) {
// Give the menu time to close before changing to logged out
this.userData.logout();
//these are the 3 attempts i've made below, all of which don't work
//this.nav.setRoot(TutorialPage);
//this.nav.setRoot('Tutorial');
//this.openTutorial();
}
}
The error I get when trying all 3 of these attempts is:
Didn't set nav root: invalid link: TutorialPage
Any insight as to what I’m doing wrong? Should be having logout button call a different function entirely somehow?
Thank you