From 227f1c5782cf0a17513c7e1182b5f2d46bbd2e57 Mon Sep 17 00:00:00 2001 From: Olly Hearn Date: Sat, 20 Apr 2024 17:59:17 +0300 Subject: [PATCH] fixes & spin global icon --- frontend/app/src/components/AuthModal.tsx | 22 ++++++++++--------- .../app/src/config/ThemeProviderWrapper.tsx | 4 +++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/frontend/app/src/components/AuthModal.tsx b/frontend/app/src/components/AuthModal.tsx index 720365e..b91c59b 100644 --- a/frontend/app/src/components/AuthModal.tsx +++ b/frontend/app/src/components/AuthModal.tsx @@ -44,8 +44,10 @@ const AuthModal = (props: { const [captchaId, setCaptchaId] = useState(""); const [captchaPic, setCaptchaPic] = useState(""); + const [captchaFetching, setCaptchaFetching] = useState(false); const fetchCaptcha = async () => { + setCaptchaFetching(true); registerForm.setFieldValue(["captcha", "prompt"], ""); const id = uuidv4(); setCaptchaId(id); @@ -53,6 +55,7 @@ const AuthModal = (props: { const imageBlob = await res.blob(); const imageObjectURL = URL.createObjectURL(imageBlob); setCaptchaPic(imageObjectURL); + setCaptchaFetching(false); }; const { data, refetch, isFetching, isError } = useGetUserQuery({}); @@ -149,10 +152,7 @@ const AuthModal = (props: { okText={current === "login" ? tr("Log in") : tr("Register")} confirmLoading={isLoggingIn} > - } - > +
@@ -262,12 +262,14 @@ const AuthModal = (props: { - {captchaPic ? ( - fetchCaptcha()} - src={captchaPic} - alt={tr("Click to refresh")} - /> + {captchaId ? ( + + fetchCaptcha()} + src={captchaPic} + alt={tr("Captcha")} + /> + ) : (