Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70433

Update user data in ionic

$
0
0

@Geelario wrote:

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);
       });

  }

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70433

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>