Added pending users to user portal screen

This commit is contained in:
Dean 2023-04-26 14:16:36 +01:00
parent 3e78989e74
commit 5dff2f3017
1 changed files with 41 additions and 0 deletions

View File

@ -110,6 +110,27 @@
}
})
}
let invitesLoaded = false
let pendingInvites = []
let parsedInvites = []
const invitesToSchema = invites => {
return invites.map(invite => {
const { admin, builder, userGroups, apps } = invite.info
return {
email: invite.email,
builder,
admin,
userGroups: userGroups,
apps: apps ? [...new Set(Object.keys(apps))] : undefined,
}
})
}
$: parsedInvites = invitesToSchema(pendingInvites)
$: console.log("parsed invites ", parsedInvites)
// $: console.log(pendingInvites)
$: console.log(enrichedUsers)
const updateFetch = email => {
fetch.update({
@ -232,6 +253,9 @@
try {
await groups.actions.init()
groupsLoaded = true
pendingInvites = await users.getInvites()
invitesLoaded = true
} catch (error) {
notifications.error("Error fetching user group data")
}
@ -326,6 +350,23 @@
</div>
</Layout>
<Layout noPadding gap="M">
<Layout gap="XS" noPadding>
<Heading>Pending invitations</Heading>
<Body>A list of all pending user invitations</Body>
</Layout>
<Divider />
<Table
{schema}
data={parsedInvites}
allowEditColumns={false}
allowEditRows={false}
{customRenderers}
loading={!invitesLoaded}
/>
</Layout>
<Modal bind:this={createUserModal}>
<AddUserModal {showOnboardingTypeModal} />
</Modal>