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:
2026-10-14 11:13:53 +08:00
co-authored by Claude Sonnet 5.5
parent 550a61cedc
commit 1b84ed8625
3 changed files with 75 additions and 8 deletions
+5 -2
View File
@@ -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 (