Why My Condition always return to false condition?

Hi i tried to maintain login session , so i uses storage native to save the credential to check if users is login or not . And then i add condition when data that stored in native storage not null then the rootpage will be set in homepage, and when the data stored is null the rootpage will be set to loginpage. But i don’t know why my condition will always return else either the data null or not. Eventough i though my condition already right but it always return else. here is my code

import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import {LoginPage} from '../pages/login/login'
import { HomePage } from '../pages/home/home';
import {NativeStorage} from '@ionic-native/native-storage'
  templateUrl: 'app.html'
export class MyApp {
  rootPage:any ;
  storedauth: string;

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private nativestorage : NativeStorage) {
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
        data => this.storedauth = data.token
      if(this.storedauth != null){
        this.rootPage = HomePage;
        this.rootPage = LoginPage;

Can you guys tell me why is this not working ? and it always return false

I Just notice that this.storedauth is always null, it will be only have data when the page is active . Can you help me here guys ?

Use an observable: https://angular.io/guide/observables

Also see:

CLOSED , there is an error in my code. thanks anyway bro

      ( data=>  { 
        if(data != null){
         // this.navCtrl.setRoot(HomePage);
         this.rootPage = HomePage;


that is my fix