diff --git a/frontend/src/components/DashboardUser/TableUser.jsx b/frontend/src/components/DashboardUser/TableUser.jsx index 91189e7..9d654ff 100644 --- a/frontend/src/components/DashboardUser/TableUser.jsx +++ b/frontend/src/components/DashboardUser/TableUser.jsx @@ -137,10 +137,10 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
- {user.sumOpen ? user.sumOpen.count : "0"} + {user.sumOpen ? user.sumOpen.count : 0} - {user.sumClosed ? user.sumClosed.count : "0"} + {user.sumClosed ? user.sumClosed.count : 0}
diff --git a/frontend/src/pages/Dashboard/index.js b/frontend/src/pages/Dashboard/index.js index 4ba6a32..c3eaec2 100644 --- a/frontend/src/pages/Dashboard/index.js +++ b/frontend/src/pages/Dashboard/index.js @@ -105,7 +105,6 @@ const useStyles = makeStyles((theme) => ({ })); const reducer = (state, action) => { - if (action.type === "DELETE_USER_STATUS") { const userId = action.payload; @@ -256,18 +255,17 @@ const Dashboard = () => { useEffect(() => { const socket = openSocket(process.env.REACT_APP_BACKEND_URL); - socket.on("ticketStatus", (data) => { - if (data.action === "update") { - - // setStatus({...ticketStatusChange}, data.ticketStatus.status ) - + socket.on("ticketStatus", (data) => { + if (data.action === "update") { + console.log(ticketStatusChange); + setStatus(""); + console.log(ticketStatusChange); + setStatus(data.ticketStatus.status); } }); socket.on("onlineStatus", (data) => { if (data.action === "logout" || data.action === "update") { - // console.log('>>>>>>> data.userOnlineTime: ', data.userOnlineTime) - dispatch({ type: "UPDATE_STATUS_ONLINE", payload: data.userOnlineTime }); } else if (data.action === "delete") { dispatch({ type: "DELETE_USER_STATUS", payload: data.userOnlineTime }); @@ -286,8 +284,7 @@ const Dashboard = () => { }, []); useEffect(() => { - - + if (ticketStatusChange === "") return console.log("foi"); const delayDebounceFn = setTimeout(() => { const fetchQueries = async () => { try { @@ -310,7 +307,7 @@ const Dashboard = () => { } catch (err) { console.log(err); } - }; + }; fetchQueries(); }, 500); @@ -334,7 +331,10 @@ const Dashboard = () => { > tickets @@ -410,7 +410,10 @@ const Dashboard = () => { > Usuários @@ -494,4 +497,4 @@ const Dashboard = () => { ); }; -export default Dashboard; +export default Dashboard;