Apply validation to invite users by email + results modal

This commit is contained in:
Rory Powell 2022-09-01 07:58:05 +01:00 committed by Mel O'Hagan
parent 22a4fd0d35
commit 5a4d8dafb9
2 changed files with 10 additions and 13 deletions

View File

@ -7,7 +7,6 @@
Table, Table,
Layout, Layout,
Modal, Modal,
ModalContent,
Search, Search,
notifications, notifications,
Pagination, Pagination,
@ -23,6 +22,7 @@
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import OnboardingTypeModal from "./_components/OnboardingTypeModal.svelte" import OnboardingTypeModal from "./_components/OnboardingTypeModal.svelte"
import PasswordModal from "./_components/PasswordModal.svelte" import PasswordModal from "./_components/PasswordModal.svelte"
import InvitedModal from "./_components/InvitedModal.svelte"
import ImportUsersModal from "./_components/ImportUsersModal.svelte" import ImportUsersModal from "./_components/ImportUsersModal.svelte"
import { get } from "svelte/store" import { get } from "svelte/store"
import { Constants, Utils, fetchData } from "@budibase/frontend-core" import { Constants, Utils, fetchData } from "@budibase/frontend-core"
@ -67,6 +67,8 @@
sortable: false, sortable: false,
}, },
} }
$: userData = []
$: inviteUsersResponse = { successful: [], unsuccessful: [] }
$: { $: {
enrichedUsers = $fetch.rows?.map(user => { enrichedUsers = $fetch.rows?.map(user => {
let userGroups = [] let userGroups = []
@ -112,8 +114,7 @@
groups: userData.groups, groups: userData.groups,
})) }))
try { try {
const res = await users.invite(payload) inviteUsersResponse = await users.invite(payload)
notifications.success(res.message)
inviteConfirmationModal.show() inviteConfirmationModal.show()
} catch (error) { } catch (error) {
notifications.error("Error inviting user") notifications.error("Error inviting user")
@ -273,16 +274,7 @@
</Modal> </Modal>
<Modal bind:this={inviteConfirmationModal}> <Modal bind:this={inviteConfirmationModal}>
<ModalContent <InvitedModal {inviteUsersResponse} />
showCancelButton={false}
title="Invites sent!"
confirmText="Done"
>
<Body size="S">
Your users should now recieve an email invite to get access to their
Budibase account
</Body>
</ModalContent>
</Modal> </Modal>
<Modal bind:this={onboardingTypeModal}> <Modal bind:this={onboardingTypeModal}>

View File

@ -57,3 +57,8 @@ export interface CreateAdminUserRequest {
password: string password: string
tenantId: string tenantId: string
} }
export interface InviteUserRequest {
email: string
userInfo: any
}