Skip to content

Instantly share code, notes, and snippets.

@joevo2
Last active December 28, 2016 08:42
Show Gist options
  • Save joevo2/5883bd0382189c5463e858a6d4a0741b to your computer and use it in GitHub Desktop.
Save joevo2/5883bd0382189c5463e858a6d4a0741b to your computer and use it in GitHub Desktop.
validateCoupon = async (id) => {
let _this = this;
var Comments = Parse.Object.extend("Comments");
var query = new Parse.Query(Comments);
query.equalTo("objectId", id);
await query.first({
success: function (results) {
results.save(null, {
success: function (results) {
// Now let's update it with some new data. In this case, only cheatMode and score
// will get sent to the cloud. playerName hasn't changed.
results.set("coupon", true);
results.set("couponUsedDate", new Date());
results.save();
// alert('Validated');
_this.getComments();
}
});
},
error: function (error) {
alert("Error: " + error.code + " " + error.message);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment