detectBadPaginationMiddleware
Sourceimport { detectBadPaginationMiddleware } from "@prestojs/rest";
detectBadPaginationMiddleware(isPaginated)
Middleware that detects if paginationMiddleware isn't present when it should be or if
pagination
option to Endpoint.execute
hasn't been supplied.
This helps avoid cryptic errors when a response is paginated but other middleware expects to receive just the results (eg. viewModelCachingMiddleware).
It is recommended you add this to the global list of middleware:
Endpoint.defaultConfig.middleware = [...Endpoint.defaultConfig.middleware,detectBadPaginationMiddleware(),];
Parameter | Type | Description | |
---|---|---|---|
* | isPaginated | Function | Function that returns |
Returns