Interface ActionMiddleware

An action middleware.

interface ActionMiddleware {
    filter?: (ctx: ActionContext) => boolean;
    middleware: (ctx: ActionContext, next: () => any) => any;
    subtreeRoot: object;
}

Properties

filter?: (ctx: ActionContext) => boolean

A filter function to decide if an action middleware function should be run or not.

middleware: (ctx: ActionContext, next: () => any) => any

An action middleware function. Rember to return next() if you want to continue the action or throw if you want to cancel it.

subtreeRoot: object

Subtree root object (object and child objects) this middleware will run for. This target "filter" will be run before the custom filter.