Fetching Value from Storage


#1

Hi Ionic Family,
I am a newbie. I was trying to practice one Simple REST with IONIC and Node-Mongo. It is simple code. I sent my JWT-Token to IONIC and it’s storing this token into LocalStorage. Unfortunately, I am getting Object instead of Value. I saw some similar issue but not same. That’s why I am asking. Actually, I want to validate my Nav Footer so that I need this token value but Unfortunately I am not getting the value. It is showing the object instead of value. Can anyone tell me the procedure to get the value from Storage according to below code, I followed this code from one of the forum posts.

tab.ts

export class TabsPage {

  token:any;
  tab1Root = this.isLoggedIn()==null?HomePage:MainIndexPage;
  tab2Root = AboutPage;
  tab3Root = ContactPage;


  constructor(private storage: Storage, ) {

  }

ionViewDidLoad(){

                                                                                                                                                                                                                                                                        
console.log(this.isLoggedIn());

}

    isLoggedIn() {        
         return  Promise.all([
                this.StorageGet("token", true).then((data: any) => { this.token = data })
            ])          
          }
 

 private StorageGet(Key: any, Default: any) {

        return new Promise((resolve, reject) => {
            this.storage.get(Key).then((data) => {
                console.log("Token Value<<------------Storage.get ", Key, data);
                resolve(data);
            })
                .catch(() => {
                    console.log("Token Value------------>>Load DEFAULTS", Default);
                    resolve(Default);
                });
        });
    }

Hence, this is my first question on this forum. Please consider my silly mistake.
Thanks