Skip to content

Commit

Permalink
fix(amplify-category-auth): added pagination for listGroups api action (
Browse files Browse the repository at this point in the history
  • Loading branch information
muvashi committed Apr 17, 2024
1 parent 6c2e90b commit 0d52c47
Showing 1 changed file with 2 additions and 6 deletions.
Expand Up @@ -167,22 +167,18 @@ async function listUsers(Limit, PaginationToken) {
}
}

async function listGroups(Limit, PaginationToken) {
async function listGroups(Limit, NextToken) {
const params = {
UserPoolId: userPoolId,
...(Limit && { Limit }),
...(PaginationToken && { PaginationToken }),
...(NextToken && { NextToken }),
};

console.log('Attempting to list groups');

try {
const result = await cognitoIdentityProviderClient.send(new ListGroupsCommand(params));

// Rename to NextToken for consistency with other Cognito APIs
result.NextToken = result.PaginationToken;
delete result.PaginationToken;

return result;
} catch (err) {
console.log(err);
Expand Down

0 comments on commit 0d52c47

Please sign in to comment.