Best practice for rootPage and lazy loading

We are using Ionic3 with lazy loading and we were wondering how to handle the case when the user is navigating say: mywebsite.com/example and they refresh that page.
If we use something like this, the problem is that the rootPage is first set to ExamplePage (due to the URL), but then it is automatically changed to WelcomePage.
After some changes, we got to the following solution but we aren’t sure it is the best way to do it.

@Component({
  selector: 'page-menu',
  templateUrl: 'app.html'
})
export class MyApp {
  @ViewChild(Nav) nav: Nav;

  rootPage: string = WelcomePage;

  constructor(
    private userProvider: UserProvider,
    private platform: Platform,
    private splashScreen: SplashScreen
  ) {
    this.platform.ready().then(() => {
      this.userProvider.isAuthenticated().then((isAuthenticated) => {
        this.splashScreen.hide();
        if (!isAuthenticated && this.nav.root !== LoginPage) {
          this.nav.setRoot(LoginPage);
        }
      });
    });
  }
}

Hi,

Is there any solution for this.