mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix onChallengeVerification
This commit is contained in:
@@ -92,17 +92,20 @@ const Board = () => {
|
||||
};
|
||||
|
||||
|
||||
const onChallengeVerificationRef = useRef();
|
||||
|
||||
const onChallengeVerification = (challengeVerification) => {
|
||||
if (challengeVerification.challengeSuccess === true) {
|
||||
setSuccessMessage('challenge success', {publishedCid: challengeVerification.publication.cid});
|
||||
setSelectedThread(challengeVerification.publication.cid);
|
||||
navigate(`/p/${selectedAddress}/c/${challengeVerification.publication.cid}`);
|
||||
}
|
||||
else if (challengeVerification.challengeSuccess === false) {
|
||||
setErrorMessage('challenge failed', {reason: challengeVerification.reason, errors: challengeVerification.errors});
|
||||
setErrorMessage("Error: You seem to have mistyped the CAPTCHA. Please try again.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onChallengeVerificationRef.current = onChallengeVerification;
|
||||
|
||||
|
||||
const onChallenge = async (challenges, comment) => {
|
||||
@@ -133,12 +136,20 @@ const Board = () => {
|
||||
const [publishCommentOptions, setPublishCommentOptions] = useState({
|
||||
subplebbitAddress: selectedAddress,
|
||||
onChallenge,
|
||||
onChallengeVerification,
|
||||
onChallengeVerification: onChallengeVerificationRef.current,
|
||||
onError: (error) => {
|
||||
setErrorMessage(error);
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setPublishCommentOptions((prevPublishCommentOptions) => ({
|
||||
...prevPublishCommentOptions,
|
||||
subplebbitAddress: selectedAddress,
|
||||
onChallengeVerification: onChallengeVerificationRef.current,
|
||||
}));
|
||||
}, [selectedAddress]);
|
||||
|
||||
|
||||
const handleSubmit = async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user