Interface ActionMiddleware

An action middleware.

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

Properties

filter?: ((ctx) => boolean)

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

Type declaration

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

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

Type declaration

    • (ctx, next): any
    • Parameters

      Returns any

subtreeRoot: object

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