Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I call a function using parse-server

I'm developing a JavaScript web app, and I'm trying to make a "forgot password" feature. I know how to make a function on the server-side, in the Cloud code with Parse function. But what I can't do is pass the object from my controller (in the front-end side). By the way, I'm using ember.js.

I've tried to save ("user.save()") the object (even without changing anything) and then calling Parse.Cloud.AfterSave("user",(request){..}), but I was getting a error. How can I pass an object to the Cloud code?

like image 756
M. Alves Avatar asked Feb 19 '26 00:02

M. Alves


1 Answers

In your main.js file, in order to create a cloud code function:

Parse.Cloud.define('resetPassword', async req => {
  console.log(`My user is: ${req.object.getUsername()}`);
  ...
});

In your client code, in order to call the cloud code function:

await Parse.Cloud.run('hello', { user: Parse.User.current() });
like image 64
Davi Macêdo Avatar answered Feb 20 '26 13:02

Davi Macêdo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!