-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to override default onFailure function within useShowController #5197
Comments
Any updates on this issue? |
We'll gladly accept a PR to implement it, targeting the |
Unfortunately I don't really have the time to submit a PR on this issue and test it thoroughly enough 😞 In any case, is there any alternative way to manipulate or override the default behavior of the failure scenario for In my use case it is not really pratical to rewrite a detail component using |
This issue hasn't received much interest from the community. As the core team doesn't need this feature and won't spend time implementing it, I'm closing it. Writing your own show controller logic is the right way to go. |
Is your feature request related to a problem? Please describe.
We are building a "Show" view that should be displaying different error components when API calls fail based on error status code: "Not found" (when receive 404) , "Access denied" (when receive 403), or "Request failed" (error with any other status)
Current implementation of useShowController will just display ra.notification.item_doesnt_exist message and redirect back to list.
We would like to be able to provide a custom onFailure function to useShowController to be able to override notifications and redirection, and also to return error object in the controller so we can status code to pick appropriate component to render.
Describe the solution you'd like
I would like to change the current implementation
to the following:
error
added to the return. This object will allow me to query error.status and render different error-handling components.onFailureCb({ id, resource, error, resourceName, defaultTitle})
parameters are not needed for the use case above; however they may be useful when issuing custom notifications to users and are also needed for logging errors into our web log management system.Describe alternatives you've considered
I have copied current useShowController and customized it as discussed above.
Additional context
n/a
The text was updated successfully, but these errors were encountered: