interface UseApiFormResult
extends UseFormReturn<T>

Returned by useApiForm, the form with submit added.

Type Parameters

T extends FieldValues

Properties

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

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={...}>.

Usage

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