I just updated my parse server from 2.8.4 to 4.3.0 and I understand there have been changes in how the code is now written.
So the code below…
Parse.Cloud.define("updateCourseFunction", func (request, response) {
const currentUserId = request.user.id;
const courseId = request.params.courseId;
// ---------------------------------
courseObject.save(null, {
useMasterKey: true,
success: function(savedCourseObject) {
if (savedCourseObject != null)
response.success(savedCourseObject);
else
response.success();
},
error: function(error) {
response.error(error);
}
});
});
should be like this?
Parse.Cloud.define("updateCourseFunction", async (request) => {
const currentUserId = request.user.id;
const courseId = request.params.courseId;
// ---------------------------------
try {
const savedCourseObject = await courseObject.save(null, { useMasterKey: true });
if (savedCourseObject != null)
return savedCourseObject;
else
return;
} catch (error) {
throw error;
}
});