Compare commits

..

2 Commits

Author SHA1 Message Date
adriano 435a577bed fix: listener para ticket deletado 2024-05-22 12:51:11 -03:00
adriano fce5554681 fix: update message ack 2024-05-22 09:51:10 -03:00
2 changed files with 9 additions and 4 deletions

View File

@ -451,15 +451,16 @@ const MessagesList = ({ ticketId, isGroup }) => {
socket.on("connect", onConnectMessagesList)
const onAppMessageMessagesList = (data) => {
if (+data.message.ticketId !== +ticketId) return
if (data.action === "create" && data.ticket.id == ticketId) {
if (data.action === "create") {
dispatch({ type: "ADD_MESSAGE", payload: data.message })
scrollToBottom()
}
if (data.action === "update" && data.ticket.id == ticketId) {
if (data.action === "update") {
dispatch({ type: "UPDATE_MESSAGE", payload: data.message })
}
}

View File

@ -143,11 +143,15 @@ const Ticket = () => {
socket.on("connect", onConnectTicket)
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)
}
if (data.action === "delete") {
if (data.action === "deleteForever") {
console.log('delete forever')
toast.success("Ticket deleted sucessfully.")
history.push("/tickets")
}