Back button (navigation / login <--> home <--> logout )

Hi again,

Still working on the navigation system and now, I figured another trouble.

I’ve setup the mdSwipeBack and
document.addEventListener(‘backbutton’, function (e) {
app.views.main.router.back();
});

But… when my user is logged in, he’s targeted on the login screen.
So I check before the first call, if there is a token, if yes, I load the main screen… if not, the login screen.
But when the user logout, he can swipeBack (ou click a back button) to try to go back to the main screen.

Do I need to have two views ? Or there is an other way to manage this ?

Thanks and sorry for those question.

  • add no-swipeback class to your login page to disable swipe back on it
  • check for user auth in your backbutton handler and don’t call router.back() if user is not logged in