Skip to content

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(useCaptchaModal): Add `await` to all `close()` calls to prevent them from closing properly.

haitaooed9a31da79a6
diff --git a/ui/src/components/Unactivate/index.tsx b/ui/src/components/Unactivate/index.tsx
index f5673d7d..0c8b6183 100644
--- a/ui/src/components/Unactivate/index.tsx
+++ b/ui/src/components/Unactivate/index.tsx
@@ -37,8 +37,8 @@ const Index: React.FC<IProps> = () => {
};
}
resendEmail(req)
- .then(() => {
- emailCaptcha.close();
+ .then(async () => {
+ await emailCaptcha.close();
setSuccess(true);
})
.catch((err) => {
diff --git a/ui/src/pages/Search/index.tsx b/ui/src/pages/Search/index.tsx
index 7443d05a..e064740c 100644
--- a/ui/src/pages/Search/index.tsx
+++ b/ui/src/pages/Search/index.tsx
@@ -49,8 +49,8 @@ const Index = () => {
}
getSearchResult(params)
- .then((resp) => {
- searchCaptcha.close();
+ .then(async (resp) => {
+ await searchCaptcha.close();
setData(resp);
})
.catch((err) => {
diff --git a/ui/src/pages/Users/Register/components/SignUpForm/index.tsx b/ui/src/pages/Users/Register/components/SignUpForm/index.tsx
index 0340d26b..a77508db 100644
--- a/ui/src/pages/Users/Register/components/SignUpForm/index.tsx
+++ b/ui/src/pages/Users/Register/components/SignUpForm/index.tsx
@@ -105,8 +105,8 @@ const Index: React.FC<Props> = ({ callback }) => {
}
register(reqParams)
- .then((res) => {
- emailCaptcha.close();
+ .then(async (res) => {
+ await emailCaptcha.close();
updateUser(res);
callback();
})