Hello everyone. Here is my code.
this.auth.accessUserData() -> return this.storage.get(“userData”);
this.auth.controlUserData(val) -> return this.http.post(URL,postOptions).map(res => res.json());
This code app.component.ts
this.auth.accessUserData().then(
(val) => {this.auth.controlUserData(val).subscribe( (data) =>{ if(data.error_code == 300){ this.isAuthenticated = true; this.nav.setRoot("TabsPage"); } else{ this.isAuthenticated = false; this.nav.setRoot("HomePage"); } }, err =>{ this.isAuthenticated = false; this.nav.setRoot("HomePage"); } ); }, err =>{ console.log(err) this.isAuthenticated = false; this.nav.setRoot("HomePage"); } );
Also I tried val != null