Update superadmin invite URL (#62)

This commit is contained in:
sua yoo 2021-12-05 18:22:59 -08:00 committed by GitHub
parent 5531c3c33c
commit ba69ac02bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View File

@ -69,24 +69,19 @@ export class InviteForm extends LiteElement {
async onSubmit(event: { detail: { formData: FormData } }) { async onSubmit(event: { detail: { formData: FormData } }) {
if (!this.authState) return; if (!this.authState) return;
this.serverError = undefined;
this.isSubmitting = true; this.isSubmitting = true;
const { formData } = event.detail; const { formData } = event.detail;
const inviteEmail = formData.get("inviteEmail") as string; const inviteEmail = formData.get("inviteEmail") as string;
try { try {
const data = await this.apiFetch( const data = await this.apiFetch(`/users/invite`, this.authState, {
// TODO actual path method: "POST",
`/invite`, body: JSON.stringify({
this.authState, email: inviteEmail,
{ }),
method: "POST", });
body: JSON.stringify({
email: inviteEmail,
role: Number(formData.get("role")),
}),
}
);
this.dispatchEvent( this.dispatchEvent(
new CustomEvent("success", { new CustomEvent("success", {

View File

@ -21,6 +21,11 @@ export class SignUpForm extends LiteElement {
@property({ type: String }) @property({ type: String })
inviteToken?: string; inviteToken?: string;
@property({ type: Boolean })
// TODO replace with archive info
// https://github.com/ikreymer/browsertrix-cloud/issues/35
isArchiveInvite?: boolean;
@state() @state()
private serverError?: string; private serverError?: string;
@ -133,7 +138,7 @@ export class SignUpForm extends LiteElement {
newArchive: true, newArchive: true,
}; };
if (this.inviteToken) { if (this.inviteToken && this.isArchiveInvite) {
registerParams.inviteToken = this.inviteToken; registerParams.inviteToken = this.inviteToken;
registerParams.newArchive = false; registerParams.newArchive = false;
} }