diff --git a/frontend/src/components/invite-form.ts b/frontend/src/components/invite-form.ts index ab0fabfb..5fdbbfb2 100644 --- a/frontend/src/components/invite-form.ts +++ b/frontend/src/components/invite-form.ts @@ -69,24 +69,19 @@ export class InviteForm extends LiteElement { async onSubmit(event: { detail: { formData: FormData } }) { if (!this.authState) return; + this.serverError = undefined; this.isSubmitting = true; const { formData } = event.detail; const inviteEmail = formData.get("inviteEmail") as string; try { - const data = await this.apiFetch( - // TODO actual path - `/invite`, - this.authState, - { - method: "POST", - body: JSON.stringify({ - email: inviteEmail, - role: Number(formData.get("role")), - }), - } - ); + const data = await this.apiFetch(`/users/invite`, this.authState, { + method: "POST", + body: JSON.stringify({ + email: inviteEmail, + }), + }); this.dispatchEvent( new CustomEvent("success", { diff --git a/frontend/src/components/sign-up-form.ts b/frontend/src/components/sign-up-form.ts index d4ad06ad..f24fc5ce 100644 --- a/frontend/src/components/sign-up-form.ts +++ b/frontend/src/components/sign-up-form.ts @@ -21,6 +21,11 @@ export class SignUpForm extends LiteElement { @property({ type: String }) inviteToken?: string; + @property({ type: Boolean }) + // TODO replace with archive info + // https://github.com/ikreymer/browsertrix-cloud/issues/35 + isArchiveInvite?: boolean; + @state() private serverError?: string; @@ -133,7 +138,7 @@ export class SignUpForm extends LiteElement { newArchive: true, }; - if (this.inviteToken) { + if (this.inviteToken && this.isArchiveInvite) { registerParams.inviteToken = this.inviteToken; registerParams.newArchive = false; }