mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-17 19:37:02 +00:00
code cleanup
This commit is contained in:
@@ -86,10 +86,8 @@ module.exports = {
|
||||
return null;
|
||||
},
|
||||
|
||||
getWbot: sessionId => {
|
||||
console.log(sessionId);
|
||||
console.log(sessions.map(session => session.id));
|
||||
const sessionIndex = sessions.findIndex(s => s.id === sessionId);
|
||||
getWbot: whatsappId => {
|
||||
const sessionIndex = sessions.findIndex(s => s.id === whatsappId);
|
||||
|
||||
if (sessionIndex === -1) {
|
||||
throw new Error("This Wbot session is not initialized");
|
||||
@@ -97,9 +95,9 @@ module.exports = {
|
||||
return sessions[sessionIndex];
|
||||
},
|
||||
|
||||
removeWbot: sessionId => {
|
||||
removeWbot: whatsappId => {
|
||||
try {
|
||||
const sessionIndex = sessions.findIndex(s => s.id === sessionId);
|
||||
const sessionIndex = sessions.findIndex(s => s.id === whatsappId);
|
||||
if (sessionIndex !== -1) {
|
||||
sessions[sessionIndex].destroy();
|
||||
sessions.splice(sessionIndex, 1);
|
||||
|
||||
@@ -28,7 +28,6 @@ const QrcodeModal = ({ open, onClose, whatsAppId }) => {
|
||||
useEffect(() => {
|
||||
if (!whatsAppId) return;
|
||||
const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
|
||||
console.log("connectiing");
|
||||
|
||||
socket.on("whatsappSession", data => {
|
||||
if (data.action === "update" && data.session.id === whatsAppId) {
|
||||
@@ -42,7 +41,6 @@ const QrcodeModal = ({ open, onClose, whatsAppId }) => {
|
||||
|
||||
return () => {
|
||||
socket.disconnect();
|
||||
console.log("disconnectiing");
|
||||
};
|
||||
}, [whatsAppId, onClose]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user