toolmark-monorepo / @toolmark/inertia / InertiaVisitCallbacks
Interface: InertiaVisitCallbacks
Defined in: packages/inertia/src/visit-outcome.ts:10
Callbacks accepted by an Inertia visit (router.visit / useForm().submit), structurally covering both Inertia 2's callback names (onInvalid, onException) and Inertia 3's renamed ones (onHttpException, onNetworkError). Passing every name is harmless: whichever major is installed simply never calls the names it doesn't recognize.
Properties
onCancel?
optionalonCancel?: () =>void
Defined in: packages/inertia/src/visit-outcome.ts:24
The visit was cancelled.
Returns
void
onCancelToken?
optionalonCancelToken?: (token) =>void
Defined in: packages/inertia/src/visit-outcome.ts:26
Hands back a token whose cancel() aborts the in-flight visit.
Parameters
token
cancel
Returns
void
onError?
optionalonError?: (errors) =>void
Defined in: packages/inertia/src/visit-outcome.ts:14
The server responded with validation errors, keyed by field.
Parameters
errors
Record<string, string>
Returns
void
onException?
optionalonException?: (error) =>void
Defined in: packages/inertia/src/visit-outcome.ts:22
Inertia 2: an unexpected error occurred during the visit.
Parameters
error
unknown
Returns
void
onFinish?
optionalonFinish?: (visit?) =>void
Defined in: packages/inertia/src/visit-outcome.ts:28
The visit settled, one way or another.
Parameters
visit?
cancelled?
boolean
interrupted?
boolean
Returns
void
onHttpException?
optionalonHttpException?: (response) =>void
Defined in: packages/inertia/src/visit-outcome.ts:16
Inertia 3: the server responded outside the Inertia protocol (non-2xx / non-Inertia body).
Parameters
response
unknown
Returns
void
onInvalid?
optionalonInvalid?: (response) =>void
Defined in: packages/inertia/src/visit-outcome.ts:20
Inertia 2: the server response did not carry the X-Inertia header.
Parameters
response
unknown
Returns
void
onNetworkError?
optionalonNetworkError?: (error) =>void
Defined in: packages/inertia/src/visit-outcome.ts:18
Inertia 3: the request failed before a response arrived (offline, aborted transport, …).
Parameters
error
unknown
Returns
void
onSuccess?
optionalonSuccess?: () =>void
Defined in: packages/inertia/src/visit-outcome.ts:12
The visit succeeded.
Returns
void