ctx.redirect
Perform a redirect to another action or an external URL in the user's current browser window.
- TypeScript
- JavaScript
- Python Experimental
// To another action
await ctx.redirect({ action: "edit_user", params: { id: user.id } });
// To an external URL
await ctx.redirect({ url: "https://example.com" });
// To another action
await ctx.redirect({ action: "edit_user", params: { id: user.id } });
// To an external URL
await ctx.redirect({ url: "https://example.com" });
# To another action
await ctx.redirect(action="edit_user", params={ "id": user.id })
# To an external URL
await ctx.redirect(url="https://example.com")
Requires one of action
or url
to be specified.
- TypeScript
- JavaScript
- Python Experimental
params
Optional
Record<string, any>
Arbitrary key/value pairs to send as params to the redirected route.
route
Optional
string
Redirects to another route by its slug.
url
Optional
string
Redirects to the given URL.
Returns
null
params
Optional
Record<string, any>
Arbitrary key/value pairs to send as params to the redirected route.
route
Optional
string
Redirects to another route by its slug.
url
Optional
string
Redirects to the given URL.
Returns
null
params
Optional
dict[str, Any]
Arbitrary key/value pairs to send as params to the redirected route.
route
Optional
str
Redirects to another route by its slug.
url
Optional
str
Redirects to the given URL.
Returns
None
Did this section clearly explain what you wanted to learn?