fix(capa): handle network errors, keep form locked after submit, extend tests
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,12 +38,15 @@ export function SubmitVerificationForm({ capaId }: Props) {
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}))
|
||||
setError(Array.isArray(data.details) ? data.details.join('. ') : (data.error ?? 'Submit failed. Please try again.'))
|
||||
setLoading(false)
|
||||
return
|
||||
}
|
||||
router.refresh()
|
||||
} finally {
|
||||
setLoading(false)
|
||||
return
|
||||
} catch {
|
||||
setError('Network error. Please try again.')
|
||||
}
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user