How to fetch data getting as return after registration and display in homepage?


I have created a registration form and successfully able to save the details to the database. But i couldnt fetch the data getting as return in ionic and display it in homepage ( I need to display name in homepage Eg: Welcome Emil )

Find below the code i wrote in registration.ts

 export class Register {
  user = {"name":"","email":"","dob":"","password":""}; 
  constructor(public navCtrl: NavController, public apiService: ApiService) {
  register() {
    this.apiService.postData(this.user,'register').then((result) => {
      this.responseData = result;
    }, (err) => {
        // Error message


Find below the code that i wrote in homepage.ts

export class HomePage {
  public userDetails:any;

  constructor(public navCtrl: NavController) {
     const data = JSON.parse(localStorage.getItem('user'));
     this.userDetails = data.user;
     console.log('in home ts'); 


console.log(data); return a json string in the following format

Object {name: "fjyh", email: "dfg", token: "CGZUx7RDTbEM1lrzKzQI"}
email :"dfg"
name : "fjyh"
token : "CGZUx7RDTbEM1lrzKzQI"
__proto__ : Object

But console.log( this.userDetails); returns an undefined messageā€¦ WHY???