From b4e9bbc30d404b57c6cec3588445d10c7ee0c113 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Sun, 25 Jan 2026 00:12:04 +0100 Subject: [PATCH] fix: imperatively construct captcha payload to avoid spread issues --- lib/api/organization.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/api/organization.ts b/lib/api/organization.ts index 02bde22..3cc5003 100644 --- a/lib/api/organization.ts +++ b/lib/api/organization.ts @@ -87,13 +87,14 @@ export async function sendInvitation( role: string = 'member', captcha?: { captcha_id?: string, captcha_solution?: string, captcha_token?: string } ): Promise { - const body = { + const body: any = { email, - role, - ...(captcha?.captcha_id ? { captcha_id: captcha.captcha_id } : {}), - ...(captcha?.captcha_solution ? { captcha_solution: captcha.captcha_solution } : {}), - ...(captcha?.captcha_token ? { captcha_token: captcha.captcha_token } : {}) + role } + + if (captcha?.captcha_id) body.captcha_id = captcha.captcha_id + if (captcha?.captcha_solution) body.captcha_solution = captcha.captcha_solution + if (captcha?.captcha_token) body.captcha_token = captcha.captcha_token return await authFetch(`/auth/organizations/${organizationId}/invites`, { method: 'POST',