A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: install page add form error handle
shuaicbe0bdb17a31
diff --git a/ui/src/pages/Install/components/FourthStep/index.tsx b/ui/src/pages/Install/components/FourthStep/index.tsxindex 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<Props> = ({ 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.tsxindex 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);+ }});};