mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix challenge promise leak
This commit is contained in:
@@ -86,8 +86,15 @@ const CaptchaModal = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
let isPromiseResolved = false;
|
||||||
|
|
||||||
const submitCaptcha = (callback) => {
|
const submitCaptcha = (callback) => {
|
||||||
|
if (!isPromiseResolved) {
|
||||||
setCaptchaResponse(responseRef.current.value);
|
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([]);
|
||||||
|
|||||||
Reference in New Issue
Block a user