Calling http routes inside model actions
Is there a way to call an http route inside the model actions for example, in the create.js onSuccess? Thanks!
3 Replies
Hello,
You can simply use the built in fetch (node-fetch) instance. Could you please share your use case?
Ohhh okay. Just thought maybe there's something more. Thanks!
Use case is for me to not repeat my code. I have an endpoint to approve draft order and I need to approve a draft order after creation if has a role of an admin.
Create a helper function
Use it in your route
Then also in wherever you need to call it