MalwareCheckPage: Store if they hit 'Back' btn

This commit is contained in:
David Ernst
2026-01-05 21:46:08 -08:00
parent 9f258a035b
commit 834f01313c

View File

@@ -153,26 +153,6 @@ function PageContent() {
}
}
const handleSubmitIssue = async () => {
try {
const response = await api('/malware-check/confirm', {
auth_token,
confirmed: false,
election_id,
issue_description: issueDescription,
otp,
})
if (response.ok) {
setConfirmed(true)
setShowIssueForm(false)
}
} catch (error) {
// Handle error
console.error('Failed to submit issue', error)
}
}
if (error === 'Already used')
return (
<div className="p-8">
@@ -307,13 +287,41 @@ function PageContent() {
<div className="flex gap-7 justify-end items-center mt-2">
<button
className="text-sm text-gray-400 rounded hover:text-gray-700"
onClick={() => setShowIssueForm(false)}
onClick={async () => {
await api('/malware-check/confirm', {
auth_token,
confirmed: false,
election_id,
issue_description: 'User pressed "Back" button',
otp,
})
setShowIssueForm(false)
}}
>
Back
</button>
<button
className="px-4 py-2 text-white bg-blue-500 rounded hover:bg-blue-600"
onClick={handleSubmitIssue}
onClick={async () => {
try {
const response = await api('/malware-check/confirm', {
auth_token,
confirmed: false,
election_id,
issue_description: issueDescription,
otp,
})
if (response.ok) {
setConfirmed(true)
setShowIssueForm(false)
}
} catch (error) {
// Handle error
console.error('Failed to submit issue', error)
}
}}
>
Submit
</button>