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,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([]);
|
||||
|
||||
Reference in New Issue
Block a user