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', {