Skip to content

API Documentation / pinia / _StoreOnActionListenerContext

Interface: _StoreOnActionListenerContext<Store, ActionName, A>

pinia._StoreOnActionListenerContext

Actual type for StoreOnActionListenerContext. Exists for refactoring purposes. For internal use only. For internal use only

Type parameters

NameType
StoreStore
ActionNameextends string
AA

Properties

after

after: (callback: A extends Record<ActionName, _Method> ? (resolvedReturn: _Awaited<ReturnType<A<A>[ActionName]>>) => void : () => void) => void

Sets up a hook once the action is finished. It receives the return value of the action, if it's a Promise, it will be unwrapped.

Type declaration

▸ (callback): void

Parameters
NameType
callbackA extends Record<ActionName, _Method> ? (resolvedReturn: _Awaited<ReturnType<A<A>[ActionName]>>) => void : () => void
Returns

void


args

args: A extends Record<ActionName, _Method> ? Parameters<A<A>[ActionName]> : unknown[]

Parameters passed to the action


name

name: ActionName

Name of the action


onError

onError: (callback: (error: unknown) => void) => void

Sets up a hook if the action fails. Return false to catch the error and stop it from propagating.

Type declaration

▸ (callback): void

Parameters
NameType
callback(error: unknown) => void
Returns

void


store

store: Store

Store that is invoking the action

湘ICP备2024070110号