improvement: consider loading in all websockets handlers

This commit is contained in:
canove
2020-08-10 19:12:30 -03:00
parent d747d49881
commit 1c0e251b24
3 changed files with 28 additions and 26 deletions

View File

@@ -10,6 +10,8 @@ import Paper from "@material-ui/core/Paper";
import SessionInfo from "../../components/SessionInfo";
import Qrcode from "../../components/Qrcode";
const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
const useStyles = makeStyles(theme => ({
root: {
display: "flex",
@@ -53,8 +55,6 @@ const WhatsAuth = () => {
}, []);
useEffect(() => {
const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
socket.on("qrcode", data => {
if (data.action === "update") {
setQrCode(data.qr);
@@ -74,8 +74,6 @@ const WhatsAuth = () => {
};
}, [history]);
console.log(session);
return (
<div className={classes.root}>
<Grid container spacing={3}>