2

I am using back4app as a backend for my react native app.I want to update my current logged in user details.But I could not update it to the DB.Kindly help.My code is given below.Also I get a warning: Possible Unhandles Promise Rejection(id:9)

async function UpdateMember() {
const currentUser = Parse.User.currentAsync();

const User = Parse.Object.extend('Members'); 
const query = new Parse.Query(User);
let Email = currentUser.getUsername();


query.get(Email).then(userObj => {
  // Updates the data we want
  userObj.set('Name', name);
  userObj.set('FHName', fhName);
  userObj.set('GCSNumber', gcsNumber);

  userObj.set('Department', selectedDepartments);
  userObj.set('District', selectedDistricts);
  userObj.set('Education', edu);
  userObj.set('Mobile', mobileNumber);
  userObj.set('Email', email);
  userObj.set('Designation', designation);

 
  userObj
    .save(null, {useMasterKey: true})
    .then(response => {
      console.log('Updated user', response);
      navigation.navigate('Home');
    })
    .catch(error => {
      console.error('Error while updating user', error);
    });
});

}`

rici
  • 234,347
  • 28
  • 237
  • 341
Poppy Doss
  • 23
  • 2
  • What is the link throwing the error? Anyways, I believe the problem is `const currentUser = Parse.User.currentAsync();`. Try `const currentUser = Parse.User.current();` – Davi Macêdo Jun 20 '22 at 15:00
  • It is not throwing any error. Ok I will try this and see. Thank u so much – Poppy Doss Jun 21 '22 at 03:34

0 Answers0