mirror of
https://github.com/siv-org/siv.git
synced 2026-01-09 10:27:57 -05:00
MalwareCheckPage: Store if they hit 'Back' btn
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user