mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 19:59:20 +00:00
fix: handling wwebjs erros without blocking routes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Request, Response } from "express";
|
||||
import { getIO } from "../libs/socket";
|
||||
import { initWbot } from "../libs/wbot";
|
||||
import { initWbot, removeWbot } from "../libs/wbot";
|
||||
import wbotMessageListener from "../services/WbotServices/wbotMessageListener";
|
||||
import wbotMonitor from "../services/WbotServices/wbotMonitor";
|
||||
|
||||
@@ -33,10 +33,6 @@ export const store = async (req: Request, res: Response): Promise<Response> => {
|
||||
|
||||
const whatsapp = await CreateWhatsAppService({ name, status, isDefault });
|
||||
|
||||
// if (!whatsapp) {
|
||||
// return res.status(400).json({ error: "Cannot create whatsapp session." });
|
||||
// }
|
||||
|
||||
initWbot(whatsapp)
|
||||
.then(() => {
|
||||
wbotMessageListener(whatsapp);
|
||||
@@ -70,14 +66,6 @@ export const update = async (
|
||||
|
||||
const whatsapp = await UpdateWhatsAppService({ whatsappData, whatsappId });
|
||||
|
||||
// const whatsapp = await Whatsapp.findByPk(whatsappId);
|
||||
|
||||
// if (!whatsapp) {
|
||||
// return res.status(404).json({ message: "Whatsapp not found" });
|
||||
// }
|
||||
|
||||
// await whatsapp.update(req.body);
|
||||
|
||||
const io = getIO();
|
||||
io.emit("whatsapp", {
|
||||
action: "update",
|
||||
@@ -94,7 +82,7 @@ export const remove = async (
|
||||
const { whatsappId } = req.params;
|
||||
|
||||
await DeleteWhatsAppService(whatsappId);
|
||||
// removeWbot(whatsapp.id);
|
||||
removeWbot(+whatsappId);
|
||||
|
||||
const io = getIO();
|
||||
io.emit("whatsapp", {
|
||||
|
||||
Reference in New Issue
Block a user