Whatsapp service updates

This commit is contained in:
Darren Clarke 2024-05-16 18:22:10 +02:00
parent e22a8e8d98
commit 3da103c010
16 changed files with 151 additions and 36 deletions

View file

@ -1,8 +1,12 @@
import { ServiceConfig } from "../lib/service";
// import { generateSelectOneAction } from "../lib/actions";
const getQRCode = async (id: string) => {
console.log("Getting QR code");
return "xya"; // "2hVSc9OT18wbo60WLKlVrd5KqQqYZWdH+kVlRYlrnZcKbjbzwcL4ybkS1/jGaN5bLafX9ZaR829xyhQ=";
const getQRCode = async (token: string) => {
const url = `/api/whatsapp/bots/${token}`;
const result = await fetch(url, { cache: "no-store" });
const { qr } = await result.json();
return qr ?? "";
};
export const whatsappConfig: ServiceConfig = {
@ -71,7 +75,7 @@ export const whatsappConfig: ServiceConfig = {
size: 4,
getValue: getQRCode,
helperText: "Go ahead, scan it",
refreshInterval: 5,
refreshInterval: 15,
},
],
listColumns: [