Hello, I want to be able to see the name of the user to be displayed on the next page after he log in. i see it using api in postman but with ionic i get an undefined response. please help
authservice.ts
getprotected(name) {
return this.http.get(`${this.url}/api/protected_things?name=${name}&plot=full&apikey=${this.apiKey}`, this.user).pipe(
catchError(e => {
let status = e.status;
if (status === 401) {
this.showAlert('You are not authorized for this!');
this.logout();
}
throw new Error(e);
})
)
}
tab1.ts
export class Tab1Page implements OnInit {
data = null;
constructor(private authService: AuthService, private storage: Storage, private toastController: ToastController, private http: HttpClient, private activatedRoute: ActivatedRoute) { }
ngOnInit() {
this.authService.getprotected(name).subscribe(res => {
this.data = res;
});
}
}