From 4be9c027113a1d4542c7ebbf77255d3422dd7d00 Mon Sep 17 00:00:00 2001 From: Kevin Martinez Date: Tue, 27 Feb 2024 12:41:42 -0300 Subject: [PATCH] Fix routes add ticket dialog --- src/pages/Route/Card/RouteListTicketsDialog.vue | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/pages/Route/Card/RouteListTicketsDialog.vue b/src/pages/Route/Card/RouteListTicketsDialog.vue index e5a8ac2b9..cc4515158 100644 --- a/src/pages/Route/Card/RouteListTicketsDialog.vue +++ b/src/pages/Route/Card/RouteListTicketsDialog.vue @@ -102,16 +102,13 @@ const setTicketsRoute = async () => { return; } - const updates = selectedRows.value?.map((ticket) => ({ - where: { - id: ticket.id, - data: { - routeFk: $props.id, - }, - }, - })); - - await axios.post(`Tickets/crud`, { updates }); + await Promise.all( + (selectedRows.value || []) + .filter((ticket) => ticket?.id) + .map((ticket) => + axios.patch(`Routes/${$props.id}/insertTicket`, { ticketId: ticket.id }) + ) + ); await axios.post(`Routes/${$props.id}/updateVolume`); emit('ok'); emit('hide');