Is there a way to redirect toRoute() in front w/ inertia? #4743
-
Hey guys, I'm looking for a way to redirect from react to an adonisjs route using the ".as()". Is this possible? Something like: // On react
export default function Home() {
function handleClick() {
router.redirect().toRoute('/home')
}
return (
<div>
<h1 onCLick={handleClick}>Home</h1>
</div>
)
}
// On adonisJS
router.get('/home', [HomeController, 'index']).as('home') Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
Julien-R44
Oct 1, 2024
Replies: 2 comments 2 replies
-
Hey, its covered here. https://docs.adonisjs.com/guides/views-and-templates/inertia#redirects |
Beta Was this translation helpful? Give feedback.
1 reply
-
We have a package that will likely be released in 1 to 2 weeks that will allow this. But in the meantime, you can use this community package, which seems perfect https://github.com/izzyjs/route#readme 🙂 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
shankiflang
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have a package that will likely be released in 1 to 2 weeks that will allow this. But in the meantime, you can use this community package, which seems perfect https://github.com/izzyjs/route#readme 🙂