fix: listener para ticket deletado
parent
fce5554681
commit
435a577bed
|
@ -143,11 +143,15 @@ const Ticket = () => {
|
||||||
socket.on("connect", onConnectTicket)
|
socket.on("connect", onConnectTicket)
|
||||||
|
|
||||||
const onTicketTicket = (data) => {
|
const onTicketTicket = (data) => {
|
||||||
if (data.action === "update" && data.ticket.id == ticketId) {
|
const isSameTicket = +data?.ticket?.id === +ticketId || +data.ticketId === +ticketId
|
||||||
|
if (!isSameTicket) return
|
||||||
|
|
||||||
|
if (data.action === "update") {
|
||||||
setTicket(data.ticket)
|
setTicket(data.ticket)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.action === "delete") {
|
if (data.action === "deleteForever") {
|
||||||
|
console.log('delete forever')
|
||||||
toast.success("Ticket deleted sucessfully.")
|
toast.success("Ticket deleted sucessfully.")
|
||||||
history.push("/tickets")
|
history.push("/tickets")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue