From f1c416e0a0682a939dc6ba1868d2ce5282a849bd Mon Sep 17 00:00:00 2001 From: vapao Date: Wed, 16 Jun 2021 09:36:32 +0800 Subject: [PATCH] fix add host issues --- spug_web/src/pages/host/Form.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spug_web/src/pages/host/Form.js b/spug_web/src/pages/host/Form.js index 36b77fc8..01c9851b 100644 --- a/spug_web/src/pages/host/Form.js +++ b/spug_web/src/pages/host/Form.js @@ -14,7 +14,6 @@ export default observer(function () { const [form] = Form.useForm(); const [loading, setLoading] = useState(false); const [uploading, setUploading] = useState(false); - const [password, setPassword] = useState(); const [fileList, setFileList] = useState([]); useEffect(() => { @@ -36,10 +35,11 @@ export default observer(function () { if (formData.pkey) { message.error('独立密钥认证失败') } else { + const onChange = v => formData.password = v; Modal.confirm({ icon: , title: '首次验证请输入密码', - content: , + content: , onOk: () => handleConfirm(formData), }) } @@ -53,8 +53,7 @@ export default observer(function () { } function handleConfirm(formData) { - if (password) { - formData['password'] = password; + if (formData.password) { return http.post('/api/host/', formData).then(res => { message.success('验证成功'); store.formVisible = false; @@ -79,7 +78,7 @@ export default observer(function () { const ConfirmForm = (props) => (
- setPassword(e.target.value)}/> + props.onChange(e.target.value)}/>
)