From cbe0bdb17a31ada0ad7209c7729159794e194964 Mon Sep 17 00:00:00 2001 From: shuai Date: Thu, 10 Nov 2022 16:59:28 +0800 Subject: [PATCH 1/2] fix: install page add form error handle --- .../pages/Install/components/FourthStep/index.tsx | 2 +- ui/src/pages/Install/index.tsx | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ui/src/pages/Install/components/FourthStep/index.tsx b/ui/src/pages/Install/components/FourthStep/index.tsx index 3807ac69..412b1912 100644 --- a/ui/src/pages/Install/components/FourthStep/index.tsx +++ b/ui/src/pages/Install/components/FourthStep/index.tsx @@ -101,7 +101,7 @@ const Index: FC = ({ visible, data, changeCallback, nextCallback }) => { if (admin_email.value && !admin_email.value.match(mailReg)) { bol = false; data.admin_email = { - value: '', + value: admin_email.value, isInvalid: true, errorMsg: t('admin_email.msg.incorrect'), }; diff --git a/ui/src/pages/Install/index.tsx b/ui/src/pages/Install/index.tsx index d4170ca2..8e9e22a3 100644 --- a/ui/src/pages/Install/index.tsx +++ b/ui/src/pages/Install/index.tsx @@ -76,7 +76,7 @@ const Index: FC = () => { errorMsg: '', }, site_url: { - value: '', + value: window.location.origin, isInvalid: false, errorMsg: '', }, @@ -104,6 +104,9 @@ const Index: FC = () => { const handleChange = (params: FormDataType) => { // console.log(params); + setErrorData({ + msg: '', + }); setFormData({ ...formData, ...params }); }; @@ -150,11 +153,9 @@ const Index: FC = () => { }; dbCheck(params) .then(() => { - // handleNext(); checkInstall(); }) .catch((err) => { - console.log(err); handleErr(err); }); }; @@ -174,7 +175,13 @@ const Index: FC = () => { handleNext(); }) .catch((err) => { - handleErr(err); + if (err.isError && err.key) { + formData[err.key].isInvalid = true; + formData[err.key].errorMsg = err.value; + setFormData({ ...formData }); + } else { + handleErr(err); + } }); }; From 6ce4fc8cb6cc11a0dda6eca9d1fa072ca6fe0f65 Mon Sep 17 00:00:00 2001 From: shuai Date: Thu, 10 Nov 2022 17:02:52 +0800 Subject: [PATCH 2/2] fix: style adjustment --- ui/src/pages/Search/components/Head/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/pages/Search/components/Head/index.tsx b/ui/src/pages/Search/components/Head/index.tsx index f8d07e7a..45906e05 100644 --- a/ui/src/pages/Search/components/Head/index.tsx +++ b/ui/src/pages/Search/components/Head/index.tsx @@ -41,7 +41,7 @@ const Index: FC = ({ data }) => {
{options?.length && ( <> - {t('options')} + {t('options')} {options?.map((item) => { return {item} ; })}