Skip to content

Commit

Permalink
supports roleId and accessLevel from stigmanager api
Browse files Browse the repository at this point in the history
  • Loading branch information
Matte22 committed Jan 21, 2025
1 parent af05acb commit 4a01cb5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,14 @@ export function postReviews(collectionId, assetId, reviews) {
}

export async function getUser() {
cache.user = await apiRequest({endpoint: '/user'})
const user = await apiRequest({endpoint: '/user'})

user.collectionGrants = user.collectionGrants?.map(({ accessLevel, ...grant }) => ({
...grant,
roleId: grant.roleId ?? accessLevel
})) || []

cache.user = user
return cache.user
}

Expand Down

0 comments on commit 4a01cb5

Please sign in to comment.