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")} + /> + ) : ( fetchCaptcha()} diff --git a/frontend/app/src/config/ThemeProviderWrapper.tsx b/frontend/app/src/config/ThemeProviderWrapper.tsx index 6798350..e168c97 100644 --- a/frontend/app/src/config/ThemeProviderWrapper.tsx +++ b/frontend/app/src/config/ThemeProviderWrapper.tsx @@ -1,12 +1,14 @@ import React, { ReactNode } from "react"; import { useSelector } from "react-redux"; import { StorePrototype } from "./store"; -import { ConfigProvider } from "antd"; +import { ConfigProvider, Spin } from "antd"; import { darkTheme, lightTheme } from "./style"; import PropTypes from "prop-types"; +import { LoadingOutlined } from "@ant-design/icons"; const ThemeProviderWrapper = ({ children }: { children: ReactNode }) => { const theme = useSelector((state: StorePrototype) => state.settings.theme); + Spin.setDefaultIndicator(); return (