Update superadmin invite URL (#62)
This commit is contained in:
parent
5531c3c33c
commit
ba69ac02bc
@ -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", {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user