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,13 +87,14 @@ export async function sendInvitation(
role: string = 'member',
captcha?: { captcha_id?: string, captcha_solution?: string, captcha_token?: string }
): Promise<OrganizationInvitation> {
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<OrganizationInvitation>(`/auth/organizations/${organizationId}/invites`, {
method: 'POST',