issues/27: validate only fields present in resource config
This commit is contained in:
committed by
Valeriy Petrov
parent
67388d9628
commit
40fcfc303e
@@ -241,13 +241,14 @@ export const ContentEditPage = ({ config, hooks, isCreate = false }) => {
|
||||
|
||||
const validateClient = () => {
|
||||
const next = {}
|
||||
if (!String(form.name ?? '').trim()) {
|
||||
const has = (key) => config.fields.some((f) => f.key === key)
|
||||
if (has('name') && !String(form.name ?? '').trim()) {
|
||||
next.name = 'Название не может быть пустым'
|
||||
}
|
||||
if (!String(form.alias ?? '').trim()) {
|
||||
if (has('alias') && !String(form.alias ?? '').trim()) {
|
||||
next.alias = 'Alias не может быть пустым'
|
||||
}
|
||||
if (form.regionId === '' || form.regionId == null) {
|
||||
if (has('regionId') && (form.regionId === '' || form.regionId == null)) {
|
||||
next.regionId = 'Укажите регион'
|
||||
}
|
||||
return next
|
||||
|
||||
Reference in New Issue
Block a user