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 } }) {
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", {

View File

@ -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;
}