fix: bugs de atualizacao dos tickets tempo real
parent
62f137d884
commit
7bb73cfa19
|
@ -452,14 +452,14 @@ const MessagesList = ({ ticketId, isGroup }) => {
|
|||
|
||||
const onAppMessageMessagesList = (data) => {
|
||||
|
||||
if (data.action === "create") {
|
||||
if (data.action === "create" && data.ticket.id == ticketId) {
|
||||
|
||||
dispatch({ type: "ADD_MESSAGE", payload: data.message })
|
||||
|
||||
scrollToBottom()
|
||||
}
|
||||
|
||||
if (data.action === "update") {
|
||||
if (data.action === "update" && data.ticket.id == ticketId) {
|
||||
dispatch({ type: "UPDATE_MESSAGE", payload: data.message })
|
||||
}
|
||||
}
|
||||
|
@ -467,6 +467,7 @@ const MessagesList = ({ ticketId, isGroup }) => {
|
|||
socket.on("appMessage", onAppMessageMessagesList)
|
||||
|
||||
return () => {
|
||||
socket.emit("leaveChatBox", ticketId)
|
||||
socket.off("connect", onConnectMessagesList)
|
||||
socket.off("appMessage", onAppMessageMessagesList)
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ const Ticket = () => {
|
|||
socket.on("connect", onConnectTicket)
|
||||
|
||||
const onTicketTicket = (data) => {
|
||||
if (data.action === "update") {
|
||||
if (data.action === "update" && data.ticket.id == ticketId) {
|
||||
setTicket(data.ticket)
|
||||
}
|
||||
|
||||
|
|
|
@ -246,6 +246,7 @@ const TicketsList = (props) => {
|
|||
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
|
||||
|
||||
const shouldUpdateTicket = ticket =>
|
||||
(status === ticket.status) &&
|
||||
(!ticket.userId || ticket.userId === user?.id || showAll) &&
|
||||
(!ticket.queueId || selectedQueueIds.indexOf(ticket.queueId) > -1)
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ const TransferTicketModal = ({ modalOpen, onClose, ticketid }) => {
|
|||
required
|
||||
>
|
||||
<MenuItem style={{ background: "white", }} value={''}> </MenuItem>
|
||||
{queues.map((queue) => (
|
||||
{queues?.map((queue) => (
|
||||
<MenuItem
|
||||
key={queue.id}
|
||||
value={queue.id}
|
||||
|
|
Loading…
Reference in New Issue