From b9c9d27a6c5956f0580e050c40c7595c87a3170a Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Sat, 9 Sep 2023 22:37:51 +0200 Subject: [PATCH] fix submit a challenge pressing enter --- src/components/modals/CaptchaModal.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/modals/CaptchaModal.jsx b/src/components/modals/CaptchaModal.jsx index b5aa4438..7ac7cb79 100644 --- a/src/components/modals/CaptchaModal.jsx +++ b/src/components/modals/CaptchaModal.jsx @@ -37,7 +37,6 @@ const CaptchaModal = () => { }, [isCaptchaOpen, setIsAuthorDelete, setIsAuthorEdit, setIsModEdit]); - useEffect(() => { const handleResize = () => setIsMobile(window.innerWidth <= 480); window.addEventListener('resize', handleResize); @@ -71,7 +70,10 @@ const CaptchaModal = () => { const handleKeyDown = (event) => { if (event.key === "Enter") { event.preventDefault(); - submitCaptcha(); + submitCaptcha((response) => { + setCaptchaResponse(response); + resolveCaptchaPromise(response); + }); } };