Add a proper way to handle routes override in @forestadmin/agent

In the previous version, we used route overrides (on update or delete routes) to stop the execution and make a call to our backend instead (which had all the validations, conditionals etc.)

And while we can technically still do the same with before hooks and stop the execution by throwing an error with a success message, it’s not ideal, to say the least.

Is there any way to stop execution in hooks, in a graceful way? Considering we make an external call to a separate API that may have either succeeded or failed. Or do you have some other suggestion of how to achieve this, without route overrides?

Context

  • Project name: PayAtt Internal Admin Portal
  • Team name: All teams
  • Environment name: DEVELOPMENT | VLADYSLAVNIKIFOROV (REWRITE)
  • Agent (forest package) name & version: “@forestadmin/agent”: “^1.16.2”, “@forestadmin/datasource-mongoose”: “^1.5.1”
  • Database type: MongoDB
  • Recent changes made on your end if any: Migrating to a new agent

Hello @Vladislav

Unfortunately, this is not yet possible. But we’ll take your feedback in consideration to implement a way of stopping the execution without throwing

The only workaround I can suggest you is for the delete

You can create a Smart Action to handle the delete behavior and remove the delete permission in the roles, so the only delete action will be your smart action

Nicolas