From 40fcfc303ec81735857797a4a6ef578ef3d1a4ac Mon Sep 17 00:00:00 2001 From: Valery Petrov Date: Wed, 20 May 2026 14:08:08 +0300 Subject: [PATCH] issues/27: validate only fields present in resource config --- src/pages/content/ContentEditPage.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/content/ContentEditPage.jsx b/src/pages/content/ContentEditPage.jsx index 6428dd9..76e3888 100644 --- a/src/pages/content/ContentEditPage.jsx +++ b/src/pages/content/ContentEditPage.jsx @@ -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