Skip to content

Commit

Permalink
Merge pull request MarcosHCK#50 from MarcosHCK/fixing-bugs
Browse files Browse the repository at this point in the history
Roles composition bug fixed
  • Loading branch information
MarcosHCK authored Nov 25, 2023
2 parents 842d1ab + b1fb1ad commit 6929f63
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/WebAPI/ClientApp/src/services/AuthorizeProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export function AuthorizeProvider (props)
const [ isAuthorized, userProfile ] = await Promise.all (promises)

const roles = typeof userProfile.role === 'string'
? { [userProfile.role] : true }
: userProfile.role.reduce ((acc, role, index) =>
{
return { ...acc, [ role[index] ] : true }
})
? ({ [userProfile.role] : true })
: (Array.isArray (userProfile.role) === false
? ({ })
: userProfile.role.reduce ((acc, role, index) =>
({ ...acc, [ role[index] ] : true })))

setIsAuthorized (isAuthorized)
setIsReady (true)
Expand Down

0 comments on commit 6929f63

Please sign in to comment.