can't get redirect() working after a delete request #4775
-
I have in my front-end a list of contacts. I need to delete a contact and refresh the page. const supprimerContact = (data:Contact)=>{
}) in my controller i write this public async destruct({ request, inertia , response }: HttpContext) {
response.redirect().toRoute('clients/clients', { clientData:client,contactData: newContact }) } and this is my routes router.group(()=>{ router.get('contacts', [ContactsController,'show']) router.delete('contacts',[ContactsController,'destruct']) }).prefix('/contacts') I got this error "Cannot lookup route "clients/clients"" and i dont understand why adonis can't find the route |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @mehdirayan! 👋🏻 The router is looking for a route with the name 📚 https://docs.adonisjs.com/guides/basics/response#redirects |
Beta Was this translation helpful? Give feedback.
hi every body
this is working for me
public async destruct({ request, response }: HttpContext) {
}
The redirect alone doesn't send query parameters. i had to add withQs() function.
thanks for help!