Skip to content

Commit 738a9f6

Browse files
committed
feat(cli): Give paginate the option to accept more queries
1 parent 8738085 commit 738a9f6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

templates/cli/lib/paginate.js.twig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ const paginate = async (action, args = {}, limit = 100, wrapper = '') => {
55

66
while (true) {
77
const offset = pageNumber * limit;
8-
8+
const additionalQueries = [];
9+
if (args.queries) {
10+
additionalQueries.push(...args.queries);
11+
}
912
// Merge the limit and offset into the args
1013
const response = await action({
1114
...args,
1215
queries: [
16+
...additionalQueries,
1317
JSON.stringify({ method: 'limit', values: [limit] }),
1418
JSON.stringify({ method: 'offset', values: [offset] })
1519
]
@@ -48,4 +52,4 @@ const paginate = async (action, args = {}, limit = 100, wrapper = '') => {
4852

4953
module.exports = {
5054
paginate
51-
};
55+
};

0 commit comments

Comments
 (0)