Skip to content

Commit

Permalink
Merge pull request #29 from contentstack/export-csv
Browse files Browse the repository at this point in the history
Handled the case where a user has no roles for an organization
  • Loading branch information
abhinav-from-contentstack authored Mar 15, 2021
2 parents f831b86 + dc20bd4 commit 7330a91
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/export-to-csv/src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ function getOrganizationsWhereUserIsAdmin(managementAPIClient) {
.getUser({include_orgs_roles: true})
.then(response => {
let organizations = response.organizations.filter(org => {
const org_role = org.org_roles.shift()
return org_role.admin
if (org.org_roles) {
const org_role = org.org_roles.shift()
return org_role.admin
}
return false
})
organizations.forEach(org => {
result[org.name] = org.uid
Expand Down

0 comments on commit 7330a91

Please sign in to comment.