Correção da atualização do pending
parent
3e418f7c92
commit
5c34b7911e
|
@ -51,7 +51,7 @@ const UpdateTicketService = async ({
|
||||||
|
|
||||||
await ticket.reload();
|
await ticket.reload();
|
||||||
|
|
||||||
const io = getIO();
|
let io = getIO();
|
||||||
|
|
||||||
if (ticket.status !== oldStatus || ticket.user?.id !== oldUserId) {
|
if (ticket.status !== oldStatus || ticket.user?.id !== oldUserId) {
|
||||||
io.to(oldStatus).emit("ticket", {
|
io.to(oldStatus).emit("ticket", {
|
||||||
|
@ -72,7 +72,7 @@ const UpdateTicketService = async ({
|
||||||
|
|
||||||
io.emit("ticketStatus", {
|
io.emit("ticketStatus", {
|
||||||
action: "update",
|
action: "update",
|
||||||
ticketStatus: {ticketId: ticket.id, status: ticket.status}
|
ticketStatus: { ticketId: ticket.id, status: ticket.status }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -163,27 +163,16 @@ const reducer = (state, action) => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(onlineUser.openClosedInQueue){
|
if (onlineUser.openClosedInQueue) {
|
||||||
state[index].openClosedInQueue = onlineUser.openClosedInQueue
|
state[index].openClosedInQueue = onlineUser.openClosedInQueue
|
||||||
}
|
}
|
||||||
if(onlineUser.openClosedOutQueue){
|
if (onlineUser.openClosedOutQueue) {
|
||||||
state[index].openClosedOutQueue = onlineUser.openClosedOutQueue
|
state[index].openClosedOutQueue = onlineUser.openClosedOutQueue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if(onlineUser.closedTicketByUserIn){
|
|
||||||
// state[index].closedTicketByUserIn = onlineUser.closedTicketByUserIn
|
|
||||||
// }
|
|
||||||
// if(onlineUser.closedTicketByUserOut){
|
|
||||||
// state[index].closedTicketByUserOut = onlineUser.closedTicketByUserOut
|
|
||||||
// }
|
|
||||||
// if(onlineUser.openTicketByUserIn){
|
|
||||||
// state[index].openTicketByUserIn = onlineUser.openTicketByUserIn
|
|
||||||
// }
|
|
||||||
// if(onlineUser.openTicketByUserOut){
|
|
||||||
// state[index].openTicketByUserOut = onlineUser.openTicketByUserOut
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return [...state]
|
return [...state]
|
||||||
|
@ -291,9 +280,13 @@ const Dashboard = () => {
|
||||||
|
|
||||||
socket.on("ticketStatus", (data) => {
|
socket.on("ticketStatus", (data) => {
|
||||||
|
|
||||||
// console.log('data: ',data)
|
console.log('data: ', data)
|
||||||
|
|
||||||
if(data.action === "update"){
|
if (data.action === "update") {
|
||||||
|
|
||||||
|
setStatus('')
|
||||||
|
|
||||||
|
console.log('data.ticketStatus.status: ', data.ticketStatus.status)
|
||||||
setStatus(data.ticketStatus.status)
|
setStatus(data.ticketStatus.status)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -332,8 +325,9 @@ const Dashboard = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
||||||
const delayDebounceFn = setTimeout(() => {
|
if (ticketStatusChange === '') return
|
||||||
|
|
||||||
|
const delayDebounceFn = setTimeout(() => {
|
||||||
const fetchQueries = async () => {
|
const fetchQueries = async () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -360,6 +354,7 @@ const Dashboard = () => {
|
||||||
}, 500);
|
}, 500);
|
||||||
return () => clearTimeout(delayDebounceFn);
|
return () => clearTimeout(delayDebounceFn);
|
||||||
|
|
||||||
|
|
||||||
}, [ticketStatusChange]);
|
}, [ticketStatusChange]);
|
||||||
|
|
||||||
|
|
||||||
|
@ -510,7 +505,7 @@ const Dashboard = () => {
|
||||||
userInfo.openClosedInQueue.map((info, index) => (
|
userInfo.openClosedInQueue.map((info, index) => (
|
||||||
<>
|
<>
|
||||||
<Typography component="h1" key={index}>
|
<Typography component="h1" key={index}>
|
||||||
{info.name}: OPEN {info.countOpen} | CLOSED {info.countClosed}
|
{info.name}: OPEN {info.countOpen} | CLOSED {info.countClosed}
|
||||||
</Typography>
|
</Typography>
|
||||||
</>
|
</>
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in New Issue