Correção do count no Tableuser e atualizaçã para exibir a quantidade de tickets aberto/fechado em tempo real

pull/20/head
adriano 2022-08-10 12:55:56 -03:00
parent 3bfcf56ad8
commit ec19fb6799
2 changed files with 6 additions and 8 deletions

View File

@ -94,7 +94,7 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
</TableHead> </TableHead>
<TableBody> <TableBody>
{usersOnlineInfo && {usersOnlineInfo &&
usersOnlineInfo usersOnlineInfo
.filter((e) => { .filter((e) => {
if (filterStatus === null) return e; if (filterStatus === null) return e;
@ -135,9 +135,9 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
</TableCell> </TableCell>
<TableCell> <TableCell>
<div style={{ display: "flex", alignItems: "center", gap: "12px" }}> <div style={{ display: "flex", alignItems: "center", gap: "12px" }}>
<Typography className={classes.tableCounterOpen}> <Typography className={classes.tableCounterOpen}>
{user.sumOpen === undefined ? 0 : user.sumOpen} {user.sumOpen === undefined ? 0 : user.sumOpen.count}
</Typography> </Typography>
<Typography className={classes.tableCounterClosed}> <Typography className={classes.tableCounterClosed}>
{user.sumClosed === undefined ? 0 : user.sumClosed.count} {user.sumClosed === undefined ? 0 : user.sumClosed.count}

View File

@ -256,10 +256,8 @@ const Dashboard = () => {
const socket = openSocket(process.env.REACT_APP_BACKEND_URL); const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
socket.on("ticketStatus", (data) => { socket.on("ticketStatus", (data) => {
if (data.action === "update") { if (data.action === "update") {
console.log(ticketStatusChange); setStatus("");
setStatus("");
console.log(ticketStatusChange);
setStatus(data.ticketStatus.status); setStatus(data.ticketStatus.status);
} }
}); });
@ -281,7 +279,7 @@ const Dashboard = () => {
return () => { return () => {
socket.disconnect(); socket.disconnect();
}; };
}, [ticketStatusChange]); }, []);
useEffect(() => { useEffect(() => {
if (ticketStatusChange === "") return console.log("foi"); if (ticketStatusChange === "") return console.log("foi");