diff --git a/modules/rmeets/mod.ts b/modules/rmeets/mod.ts index 4ec74bb..0eed1af 100644 --- a/modules/rmeets/mod.ts +++ b/modules/rmeets/mod.ts @@ -18,11 +18,17 @@ const routes = new Hono(); // ── Meeting Intelligence API helper ── -async function miApiFetch(path: string): Promise<{ ok: boolean; data?: any; error?: string }> { +async function miApiFetch(path: string, options?: { method?: string; body?: any }): Promise<{ ok: boolean; data?: any; error?: string }> { try { const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 8000); - const res = await fetch(`${MI_API_URL}${path}`, { signal: controller.signal }); + const fetchOpts: RequestInit = { signal: controller.signal }; + if (options?.method) fetchOpts.method = options.method; + if (options?.body) { + fetchOpts.headers = { "Content-Type": "application/json" }; + fetchOpts.body = JSON.stringify(options.body); + } + const res = await fetch(`${MI_API_URL}${path}`, fetchOpts); clearTimeout(timeout); if (!res.ok) return { ok: false, error: `API returned ${res.status}` }; return { ok: true, data: await res.json() }; @@ -58,6 +64,7 @@ const MI_STYLES = `