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