1

I've this problem: I've seen that in Parse JS documentation, to retrieve a field from a Parse Object or a Parse User, I have to do this, for example: var name = currentUser.get('first_name');. I'm using it on Express.js, the problem is that it works only if, for example, first_name was just set in the past. If the field is empty, it doesn't retrieve anything and lock my Express app. To retrieve this user, I've made simple request:

   request({

      uri:'http://myapp.herokuapp.com/parse/users/me',
      headers: {
        'X-Parse-Application-Id': 'myAppId',
        'X-Parse-Session-Token': req.session.token
      },
      json:true    

     }).then((userData) => {

       if(userData){            
          user = Parse.Object.fromJSON(userData);
          resolve(user);

       }

    }).catch((error) => {
        reject(error);
    });

and it works very well...so why does it not work? I need also to put masterKey in the request? Thank you

1 Answer 1

1

Check if the problem is due to other fields, like this:

var otherJSObject = user.get('value').id;

in this case you need to see if the value exists:

var otherJSObject = user.get('value');

if(otherJSObject)
{
 let id = otherJSObject.id;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.