From 2637720762c2fb423f786d15fb34c2a942022db9 Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Thu, 23 Dec 2021 11:53:56 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0?= =?UTF-8?q?=20=D1=83=D0=BD=D0=B8=D0=BA=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D0=BB=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/AdminPanel/UserController.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pages/AdminPanel/UserController.jsx b/src/pages/AdminPanel/UserController.jsx index 2ef4756..318a273 100644 --- a/src/pages/AdminPanel/UserController.jsx +++ b/src/pages/AdminPanel/UserController.jsx @@ -14,7 +14,17 @@ export default function UserController() { const userColumns = [ makeColumn('Логин', 'login', { editable: true, - formItemRules: [{ required: true }, ...createLoginRules], + formItemRules: [ + { required: true }, + ...createLoginRules, + () => ({ + validator(_, value) { + if (!value || users.findIndex((user) => user.login === value) < 0) + return Promise.resolve() + return Promise.reject(new Error('Логин уже занят!')) + } + }) + ], sorter: makeStringSorter('login'), }), makeColumn('Фамилия', 'surname', {