fix: imperatively construct captcha payload to avoid spread issues

This commit is contained in:
Usman Baig
2026-01-25 00:12:04 +01:00
parent acb92728e3
commit b4e9bbc30d

View File

@@ -87,14 +87,15 @@ export async function sendInvitation(
role: string = 'member', role: string = 'member',
captcha?: { captcha_id?: string, captcha_solution?: string, captcha_token?: string } captcha?: { captcha_id?: string, captcha_solution?: string, captcha_token?: string }
): Promise<OrganizationInvitation> { ): Promise<OrganizationInvitation> {
const body = { const body: any = {
email, email,
role, 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 } : {})
} }
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<OrganizationInvitation>(`/auth/organizations/${organizationId}/invites`, { return await authFetch<OrganizationInvitation>(`/auth/organizations/${organizationId}/invites`, {
method: 'POST', method: 'POST',
body: JSON.stringify(body), body: JSON.stringify(body),