Skip to content

@pinia/root / pinia / _StoreOnActionListenerContext

_StoreOnActionListenerContext<Store, ActionName, A> ​

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

Type Parameters ​

Store ​

Store

ActionName ​

ActionName extends string

A ​

A

Properties ​

after() ​

ts
after: (callback) => 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.

Parameters ​

callback ​

A extends Record<ActionName, _Method> ? (resolvedReturn) => void : () => void

Returns ​

void


args ​

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

Parameters passed to the action


name ​

ts
name: ActionName;

Name of the action


onError() ​

ts
onError: (callback) => void;

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

Parameters ​

callback ​

(error) => void

Returns ​

void


store ​

ts
store: Store;

Store that is invoking the action

Released under the MIT License.