|
|
|
@ -4,6 +4,7 @@ import type { ProjectUserReqType } from 'nocodb-sdk'
|
|
|
|
|
import { |
|
|
|
|
Form, |
|
|
|
|
computed, |
|
|
|
|
emailValidator, |
|
|
|
|
extractSdkResponseErrorMsg, |
|
|
|
|
message, |
|
|
|
|
onMounted, |
|
|
|
@ -17,7 +18,6 @@ import {
|
|
|
|
|
useI18n, |
|
|
|
|
useNuxtApp, |
|
|
|
|
useProject, |
|
|
|
|
validateEmail, |
|
|
|
|
} from '#imports' |
|
|
|
|
import type { User } from '~/lib' |
|
|
|
|
import { ProjectRole } from '~/lib' |
|
|
|
@ -54,24 +54,10 @@ let usersData = $ref<Users>({ emails: undefined, role: ProjectRole.Viewer, invit
|
|
|
|
|
const formRef = ref() |
|
|
|
|
|
|
|
|
|
const useForm = Form.useForm |
|
|
|
|
|
|
|
|
|
const validators = computed(() => { |
|
|
|
|
return { |
|
|
|
|
emails: [ |
|
|
|
|
{ |
|
|
|
|
validator: (rule: any, value: string, callback: (errMsg?: string) => void) => { |
|
|
|
|
if (!value || value.length === 0) { |
|
|
|
|
callback('Email is required') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
const invalidEmails = (value || '').split(/\s*,\s*/).filter((e: string) => !validateEmail(e)) |
|
|
|
|
if (invalidEmails.length > 0) { |
|
|
|
|
callback(`${invalidEmails.length > 1 ? ' Invalid emails:' : 'Invalid email:'} ${invalidEmails.join(', ')} `) |
|
|
|
|
} else { |
|
|
|
|
callback() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
emails: [emailValidator], |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|