Fixed mirage not respecting ?limit=all queries

no issue
- the `paginatedResponse` helper util tries to convert strings to integers but had no logic for handling `'all'` so it would always default to 15 in that case
This commit is contained in:
Kevin Ansfield 2018-11-07 17:07:29 +00:00
parent 731d2a9a2e
commit f015eeb430

View File

@ -4,9 +4,13 @@ import {Response} from 'ember-cli-mirage';
export function paginatedResponse(modelName) {
return function (schema, request) {
let page = +request.queryParams.page || 1;
let limit = +request.queryParams.limit || 15;
let limit = request.queryParams.limit;
let collection = schema[modelName].all();
if (limit !== 'all') {
limit = +request.queryParams.limit || 15;
}
return paginateModelCollection(modelName, collection, page, limit);
};
}