fix: imperatively construct captcha payload to avoid spread issues
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user