From abe3a1d6f083c88e4484ee7e336ecefa4ec847eb Mon Sep 17 00:00:00 2001 From: Csaky Date: Fri, 31 May 2024 15:03:32 -0700 Subject: [PATCH 1/2] Use vee-validate for Invite form --- frontend/src/components/common/Invite.vue | 264 +++++++++--------- .../src/components/common/ShareButton.vue | 2 + .../src/components/object/ObjectMetadata.vue | 4 + .../src/components/object/ObjectTable.vue | 4 +- frontend/src/services/inviteService.ts | 34 ++- 5 files changed, 149 insertions(+), 159 deletions(-) diff --git a/frontend/src/components/common/Invite.vue b/frontend/src/components/common/Invite.vue index a65fa153..bf20f5d9 100644 --- a/frontend/src/components/common/Invite.vue +++ b/frontend/src/components/common/Invite.vue @@ -1,16 +1,10 @@ diff --git a/frontend/src/lib/primevue/index.ts b/frontend/src/lib/primevue/index.ts index 77bb82b5..d33c3c0e 100644 --- a/frontend/src/lib/primevue/index.ts +++ b/frontend/src/lib/primevue/index.ts @@ -21,6 +21,7 @@ export { default as RadioButton } from 'primevue/radiobutton'; export { default as TabView } from 'primevue/tabview'; export { default as TabPanel } from 'primevue/tabpanel'; export { default as Tag } from 'primevue/tag'; +export { default as TextArea } from 'primevue/textarea'; export { default as Toast } from 'primevue/toast'; export { default as Toolbar } from 'primevue/toolbar'; export { default as TreeTable } from 'primevue/treetable'; diff --git a/frontend/src/services/inviteService.ts b/frontend/src/services/inviteService.ts index bb5ee58d..7bb5bd3c 100644 --- a/frontend/src/services/inviteService.ts +++ b/frontend/src/services/inviteService.ts @@ -36,29 +36,21 @@ export default { permCodes: permCodes }; - // if emails param exists - if (emails && emails.length > 0) { - // create COMS invites - const invites = await Promise.all( - emails.map(async (e) => { - const token = ( - await comsAxios().post(`${PATH}`, { - ...inviteData, - email: e - }) - ).data; - return { email: e, token: token }; - }) - ); - // send invite email notifications - await this.emailInvites(resourceType, resource, currentUser, invites); - return invites; - } - // else no emails provided so make an 'open' invite - else { - const token = (await comsAxios().post(`${PATH}`, inviteData)).data; - return [{ token: token }]; - } + // create COMS invites + const invites = await Promise.all( + emails.map(async (e) => { + const token = ( + await comsAxios().post(`${PATH}`, { + ...inviteData, + email: e + }) + ).data; + return { email: e, token: token }; + }) + ); + // send invite email notifications + await this.emailInvites(resourceType, resource, currentUser, invites); + return invites; }, /**