From f6f5fa15bed3f4a56674c292a06029ef72e7ff93 Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Wed, 29 Dec 2021 12:21:57 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20=D0=9E?= =?UTF-8?q?=D0=9A=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B0=20=D0=B2=20=D0=A1=D0=BE=D1=85=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=82=D1=8C,=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=B1=D0=BB=D0=BE=D0=BA=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BD=D0=BE?= =?UTF-8?q?=D0=BF=D0=BA=D0=B8=20=D0=B4=D0=BE=20=D0=B2=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B4=D0=B0=D1=86=D0=B8=D0=B8=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ChangePassword.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/ChangePassword.tsx b/src/components/ChangePassword.tsx index 89dae19..edf4db3 100644 --- a/src/components/ChangePassword.tsx +++ b/src/components/ChangePassword.tsx @@ -23,9 +23,14 @@ const fieldRules = [...passwordRules, ...createPasswordRules] export const ChangePassword = memo(({ user, visible, onCancel, onOk }) => { const [showLoader, setShowLoader] = useState(false) const [password, setPassword] = useState('') + const [isDisabled, setIsDisabled] = useState(true) const [form] = useForm() + const onFormChange = async () => await form.validateFields() + .then(() => setIsDisabled(false)) + .catch(() => setIsDisabled(true)) + const onModalCancel = () => { form.resetFields() onCancel?.() @@ -52,6 +57,10 @@ export const ChangePassword = memo(({ user, visible, onCanc visible={visible} onCancel={onModalCancel} onOk={() => form.submit()} + okText={'Сохранить'} + okButtonProps={{ + disabled: isDisabled + }} >
(({ user, visible, onCanc form={form} name={'change-password'} onFinish={onFormFinish} + onChange={onFormChange} >