Safe action client
The safe action client instance is created by the
createSafeActionClient() function. The instance is used to create safe actions, as you have already seen in previous sections of the documentation. You can create multiple clients too, for different purposes, as explained in this section.
You can also provide functions to the client, to customize the behavior for every action you then create with it. We will explore them in detail in the following sections.
Here's a reference of all the available optional functions:
|Performs custom logic before action server code is executed, but after input from the client is validated. More information here.
|When an error occurs on the server after executing the action on the client, it lets you define custom logic to returns a custom
serverError message instead of the default one. More information here.
|When an error occurs on the server after executing the action on the client, it lets you define custom logic to log the error on the server. By default the error is logged via
console.error. More information here.