fix captcha image state

This commit is contained in:
Tom
2023-05-27 14:09:49 +02:00
parent d04dd32d5a
commit 0b877ec179
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -7,7 +7,7 @@ import Draggable from 'react-draggable';
const CaptchaModal = () => { const CaptchaModal = () => {
const { const {
challengesArray, challengesArray, setChallengesArray,
pendingComment, pendingComment,
selectedStyle, selectedStyle,
setCaptchaResponse, setCaptchaResponse,
@@ -83,6 +83,8 @@ const CaptchaModal = () => {
const submitCaptcha = (callback) => { const submitCaptcha = (callback) => {
setCaptchaResponse(responseRef.current.value); setCaptchaResponse(responseRef.current.value);
setImageSources([]);
setChallengesArray([]);
setIsCaptchaOpen(false); setIsCaptchaOpen(false);
if (callback) { if (callback) {
@@ -96,6 +98,8 @@ const CaptchaModal = () => {
isOpen={isCaptchaOpen} isOpen={isCaptchaOpen}
onRequestClose={() => { onRequestClose={() => {
submitCaptcha(); submitCaptcha();
setImageSources([]);
setChallengesArray([]);
setIsCaptchaOpen(false);}} setIsCaptchaOpen(false);}}
contentLabel="Captcha Modal" contentLabel="Captcha Modal"
shouldCloseOnEsc={false} shouldCloseOnEsc={false}
@@ -167,7 +171,7 @@ const CaptchaModal = () => {
} }
}} }}
> >
{currentChallengeIndex + 1 < totalChallenges ? "Next" : "Post"} {currentChallengeIndex + 1 < totalChallenges ? "Next" : "Submit"}
</button> </button>
</div> </div>
</div> </div>
@@ -84,7 +84,7 @@ export const StyledModal = styled(Modal)`
#nav { #nav {
float: right; float: right;
margin: 0; margin: 0;
width: 40px; width: auto;
} }
${({ selectedStyle }) => { ${({ selectedStyle }) => {