0

Below is the Signup html code with, firstname, lastname, email and password fields.

...
<ion-item>
  <ion-label stacked>First Name</ion-label>
  <ion-input type="text" value="" [(ngModel)]="userData.fname"></ion-input>
</ion-item>
...
<button ion-button full color="buttoncolor" class="signup" (click)="signup()">Signup</button>

Belows is the signup.ts file, Below Signup function is called when signup button is clicked.

responseData : any;
userData = {
'customer': {
    "email":"",
    "firstname":"",
    "lastname":"",
    "storeId":1,
    "websiteId":1
},
"password":""
};

signup() {
//REST API connection to Magento 2 for Siging up a new customer
//this.navCtrl.push(HomePage);
this.authServiceProvider.postData(this.userData, "signup").then((result) => {
  this.responseData = result;
  console.log(this.responseData);
  localStorage.setItem('userData', JSON.stringify(this.responseData));
  this.navCtrl.setRoot(HomePage);
}, (err) => {
  //connection failed error message
});
}

The users are successfully inserted into to Database, but i am not getting the response,

In the signup function when i do console.log(this.responseData); this line returns NULL.

Where am i going wrong ??

Phonolog
  • 6,321
  • 3
  • 36
  • 64
deepak murthy
  • 411
  • 3
  • 6
  • 21

0 Answers0