Edit save return to previous page
Is there a way to have the edit save button return you to the previous page instead of the list page?
2 Replies
Hi @silentnyte. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, you can customize the behavior of the save button in the edit form to redirect to a different page instead of the default list page. This can be achieved by using the
redirect
function from the useForm
hook in Refine.
Here is an example of how you can use it:
In this example, after a successful mutation, the form will redirect to the "show" page. You can replace "show"
with any page you want to redirect to. If you want to go back to the previous page, you would need to keep track of that page in your application state or in the URL, and then use that value in the redirect
function.
For more information, you can refer to the documentation on the useForm
hook and its redirect
function in the Ant Design (https://refine.dev/docs/ui-integrations/ant-design/hooks/use-form#redirect-1) and Mantine (https://refine.dev/docs/ui-integrations/mantine/hooks/use-form#redirect-1) sections of the Refine documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@395261846862561301> kapa.ai is still learning and improving, please let us know how it did by reacting below