property UseApiFormResult.submit

Wraps an async submit handler with the shared API-form lifecycle: clears the previous root error, runs the handler while RHF keeps formState.isSubmitting true, and on a thrown error surfaces a single root error via friendlyFetchError. Pair it with expectOk so API-level failures and network failures both become root errors through one code path. Returns the onSubmit handler to spread onto <form onSubmit={...}>.

Type

(handler: SubmitHandler<T>) => (e?: React.BaseSyntheticEvent) => Promise<void>

Usage

import { type UseApiFormResult } from "src/hooks/form/useApiForm.ts";