Redirect to a different resource after create
Hello, I have this 2 resources
TemplateGroup
and Template
. Every Template
belongs to a TemplateGroup
.
When I create
(or edit
) a Template
, i want to be redirected on the Show
page of the right TemplateGroup
(with the same id sent to the server)... Is there a quick way to do it, or i have to set redirect: false
and use an effect on the query object to trigger the redirect? It would be cool to set something like redirect : { resource: "template", action: "show", id: 123 }
3 Replies
exotic-emerald•2y ago
Hey @kino90 The
useNavigation
hook makes this easy. You can see the usage here. https://refine.dev/docs/api-reference/core/hooks/navigation/useNavigation/#usageuseNavigation | refine
refine uses routerProvider and comes with all redirects out of the box. It allows you to manage your routing operations in refine. Using this hook, you can manage all the routing operations of your application very easily.
exotic-emerald•2y ago
Also use it with
onSuccess
fair-rose•2y ago
worked, thank you! It's incredible how flexible is Refine! lovin' it