feat: unify Person and User creation form with conditional password
This commit is contained in:
@@ -64,18 +64,15 @@ export async function createNewPerson(formData: CreatePersonFormType) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function createPersonUserAction(
|
||||
formData: UnifiedCreateFormType,
|
||||
) {
|
||||
export async function createPersonUserAction(formData: UnifiedCreateFormType) {
|
||||
const { dictionary } = await getI18n()
|
||||
const userCopy = dictionary.admin.users
|
||||
const schemaCopy = {
|
||||
...userCopy.schema,
|
||||
...dictionary.inventory.people.schema,
|
||||
}
|
||||
const validatedFields = buildUnifiedCreateSchema(schemaCopy).safeParse(
|
||||
formData,
|
||||
)
|
||||
const validatedFields =
|
||||
buildUnifiedCreateSchema(schemaCopy).safeParse(formData)
|
||||
|
||||
if (!validatedFields.success) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user