feat: show an alert when connection with whatsapp brokes

This commit is contained in:
canove
2020-10-27 19:59:38 -03:00
parent 79e27b71cc
commit 4e259a3de7
13 changed files with 360 additions and 296 deletions

View File

@@ -2,6 +2,7 @@ import { Request, Response } from "express";
import { getWbot } from "../libs/wbot";
import ShowWhatsAppService from "../services/WhatsappService/ShowWhatsAppService";
import { StartWhatsAppSession } from "../services/WbotServices/StartWhatsAppSession";
import UpdateWhatsAppService from "../services/WhatsappService/UpdateWhatsAppService";
const store = async (req: Request, res: Response): Promise<Response> => {
const { whatsappId } = req.params;
@@ -14,9 +15,11 @@ const store = async (req: Request, res: Response): Promise<Response> => {
const update = async (req: Request, res: Response): Promise<Response> => {
const { whatsappId } = req.params;
const whatsapp = await ShowWhatsAppService(whatsappId);
await whatsapp.update({ session: "" });
const { whatsapp } = await UpdateWhatsAppService({
whatsappId,
whatsappData: { session: "" }
});
StartWhatsAppSession(whatsapp);