Good day everyone, Please I need your help on how to update a user data. I am new to angular and ionic. I have been able to retrieve user id from local storage, and also write a method that out the user new data, the problem I am having is how to update the user with the new data. This is my code below. Thanks.
// Update user info
updateMethod(){
// Retrieve user Id
let isUserLoggedIn = localStorage.getItem('currentUserId');
//this output user new info
this.user = {
first_name:this.user.first_name,
last_name: this.user.last_name,
username: this.user.username,
email: this.user.email,
billing: {
phone: this.user.billing.phone,
address_1: this.user.billing.address_1,
}
};
console.log('new update', this.user);
//update user data
this.WC.UpdateUser( isUserLoggedIn).then((data)=>{
console.log('update successful', data);
});
}