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} >