How to change the return path of the CRUD Edit page?

Hi, I'm using an Edit page for editing a resource (with Ant Design). However for this resource, I didn't provide a list page, and put the actual list page to somewhere else. Then after editing this resource it's automatically redirected to the url of the list page which doesn't exist. How can I correct it? Many thanks!
5 Replies
refine-support-bot
Hi, I am refine support bot :wave:. I am here to help you with your question. I searched for the answer to your question in the refine documentation and found an answer! 🏆
Answer: You can change the return path of the CRUD Edit page by setting the resourceNameOrRouteName property of the <EditButton> component. SOURCES: ./docs/api-reference/antd/components/buttons/edit.md

Note: If this is the answer you need, then we are very lucky. If not, please wait for someone from the refine core team or the community to try to help you.
stuck-chocolate
stuck-chocolate2y ago
But it's actually not the Edit button, I'm on an Edit page, with SaveButton which will redirect the user to a wrong return path.
absent-sapphire
absent-sapphire2y ago
Hey @_erichu useForm's redirect is default list. https://refine.dev/docs/api-reference/antd/hooks/form/useForm/#redirect
stuck-chocolate
stuck-chocolate2y ago
Thanks very much! Is it possible to control where it's redirected? Like for example a complete different page Or, how can I get a callback when the form is successfully submitted? @yildirayunlu