fix challenge promise leak

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