0
votes

when I load my ionic application I check whether or not the user is authenticated or not. If they are I set the root page to the home page but if they are not I set the root page to the login page. My issue is when I am currently on another page so the url would look like this: http://localhost:8102/#/nav/n4/location-select then I refresh the page my root page gets set back to the home page and I do not stay on the page I was currently on. Is there a way to make it so when I refresh the page I do not automatically go to the home page but stay on the current page I am on? Thanks for the help!

this.afAuth.authState.take(1).subscribe(auth => {
  if (auth)
    this.rootPage = "home";
  else
    this.rootPage = "LoginPage";
});
1
Are you developing a mobile website?Swapnil Patwa
Yes i am developing a mobile websiterpascal
Not android or ios app right?Swapnil Patwa
Well i would like to be able to do android and ios along with the web app.rpascal
Why do you want to do like this? Just for developing?Duannx

1 Answers

0
votes

There's no way and it's not a good thing to happen. When you reload your page or livereload via saving some application changes it's like you've closed and opened the application again. Having it to start in the point you've stoped would cause some crashes and it's badfor developing.

The only thing that reloads at the same page is changing CSS, then it does a hot reload that doesn't changes the page, but show changings.