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
Chocci_Milk
Chocci_Milk8mo ago
Hello, You can simply use the built in fetch (node-fetch) instance. Could you please share your use case?
Benz
BenzOP8mo ago
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.
ljspoor94
ljspoor948mo ago
Create a helper function Use it in your route Then also in wherever you need to call it

Did you find this page helpful?