fix challenge promise leak

This commit is contained in:
plebeius.eth
2023-09-16 16:41:51 +02:00
parent 3fb50b30f7
commit 4c5198f40e
+9 -1
View File
@@ -86,8 +86,15 @@ const CaptchaModal = () => {
}; };
let isPromiseResolved = false;
const submitCaptcha = (callback) => { const submitCaptcha = (callback) => {
setCaptchaResponse(responseRef.current.value); if (!isPromiseResolved) {
setCaptchaResponse(responseRef.current.value);
resolveCaptchaPromise(responseRef.current.value);
isPromiseResolved = true;
}
setImageSources([]); setImageSources([]);
setChallengesArray([]); setChallengesArray([]);
setIsCaptchaOpen(false); setIsCaptchaOpen(false);
@@ -97,6 +104,7 @@ const CaptchaModal = () => {
} }
}; };
const handleCloseModal = () => { const handleCloseModal = () => {
setImageSources([]); setImageSources([]);
setChallengesArray([]); setChallengesArray([]);