Skip to content

Commit

Permalink
fix: pass params while auto pagination is true (#7)
Browse files Browse the repository at this point in the history
While auto-paginate variable was true the parameters were not being
passed to the request being sent.

This PR fixes the above
  • Loading branch information
gondar00 authored Jun 3, 2023
1 parent f20276f commit 9fd8c8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/http/MindbodyAPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class MindbodyAPIClient extends BaseClient {
headers: headers,
firstPage: res.data,
objectIndexKey: args.objectIndexKey,
params: args.params
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/http/autoPager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export async function autoPager<T extends Returnable>(
args.client.get(args.endpoint, {
headers: args.headers,
params: {
...args.params,
Offset: offset,
Limit: limit,
},
Expand All @@ -45,6 +46,7 @@ export async function autoPager<T extends Returnable>(
args.client.get(args.endpoint, {
headers: args.headers,
params: {
...args.params,
Offset: requestCount === 1 ? limit : offset + limit,
Limit: limit,
},
Expand Down

0 comments on commit 9fd8c8d

Please sign in to comment.