From fb54bc1691713b477413b491cdb9f41e3226ab1d Mon Sep 17 00:00:00 2001 From: Leonardo da Silva Date: Sat, 26 Oct 2024 13:17:12 -0300 Subject: [PATCH] style: ticket status --- src/components/ticket/Ticket.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/ticket/Ticket.tsx b/src/components/ticket/Ticket.tsx index 9a6eda9..52d6b63 100644 --- a/src/components/ticket/Ticket.tsx +++ b/src/components/ticket/Ticket.tsx @@ -1,6 +1,6 @@ "use client"; -import {Event, Ticket} from "@/models"; +import {Event, Ticket, TicketStatus} from "@/models"; import "./style.css"; import {consumeTicket, getTicket} from "@/server-actions/ticket.action"; import {getUser} from "@/server-actions/user.action"; @@ -23,7 +23,11 @@ export default function TicketUI({id}: { id: string }) { setLoading(true); const resp = await consumeTicket(id); if (resp.error) toast.error(resp.error, toastConfig); - else toast.success("Ticket validado com sucesso!", toastConfig); + else { + toast.success("Ticket validado com sucesso!", toastConfig); + // @ts-ignore + setTicket((ticket) => ({...ticket, status: TicketStatus.CONSUMED})); + } setLoading(false); };