WhatsApp/Signal/Formstack/admin updates

This commit is contained in:
Darren Clarke 2025-11-21 14:55:28 +01:00
parent bcecf61a46
commit d0cc5a21de
451 changed files with 16139 additions and 39623 deletions

View file

@ -1,7 +1,10 @@
import { ServiceConfig } from "../lib/service";
const getQRCode = async (token: string): Promise<Record<string, string>> => {
const url = `/link/api/signal/bots/${token}`;
const basePath = window?.location?.pathname?.startsWith("/link")
? "/link"
: "";
const url = `${basePath}/api/signal/bots/${token}`;
const result = await fetch(url, { cache: "no-store" });
const { qr } = await result.json();

View file

@ -2,11 +2,28 @@ import { ServiceConfig } from "../lib/service";
// import { generateSelectOneAction } from "../lib/actions";
const getQRCode = async (token: string) => {
const url = `/link/api/whatsapp/bots/${token}`;
const result = await fetch(url, { cache: "no-store" });
const { qr } = await result.json();
try {
const url = `/link/api/whatsapp/bots/${token}`;
const result = await fetch(url, { cache: "no-store" });
return { qr, kind: "data" };
if (!result.ok) {
console.error(`Failed to fetch QR code: ${result.status} ${result.statusText}`);
return { qr: "", kind: "data" };
}
const data = await result.json();
const { qr } = data;
if (!qr) {
console.error("No QR code in response");
return { qr: "", kind: "data" };
}
return { qr, kind: "data" };
} catch (error) {
console.error("Error fetching QR code:", error);
return { qr: "", kind: "data" };
}
};
export const whatsappConfig: ServiceConfig = {