Skip to content

Commit

Permalink
Blank out the answer on blank-out click
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasnaphas committed Mar 20, 2024
1 parent 46dc8dd commit 1de9b9f
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion frontend-create-haggadah/pages/blanks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,25 @@ const PromptSection = (props: {
}
}
};

const blankOutHandler = async () => {
const submitLibSuccess = await submitLib({
answerText: "",
answerId: assignment.id,
});
if (!submitLibSuccess) {
setSubmitLibError(true);
return;
}
setAnswers((oldAnswers: any) => {
return {
...oldAnswers,
[`${assignment.id}`]: enteredText,
};
});
setSubmitLibError(false);
};

return (
<div>
<div>
Expand All @@ -113,7 +132,13 @@ const PromptSection = (props: {
<div id="current-answer">{answer}</div>
</div>
<div id="blank-out-section">
<Button id="blank-out-button">Blank out this answer</Button>
<Button
id="blank-out-button"
disabled={pageState !== PageState.READY}
onClick={blankOutHandler}
>
Blank out this answer
</Button>
</div>
</div>
)}
Expand Down

0 comments on commit 1de9b9f

Please sign in to comment.