Fix array fill logicl; allow matching on any permissions
This commit is contained in:
parent
9b4f2deb78
commit
5d5a5c2afc
3 changed files with 14 additions and 6 deletions
|
@ -6,9 +6,7 @@ export const usePermissions = (action: string | string[]): boolean[] => {
|
|||
|
||||
return useDeepMemo(() => {
|
||||
if (userPermissions[0] === '*') {
|
||||
return ([] as boolean[]).fill(
|
||||
true, 0, Array.isArray(action) ? action.length : 1,
|
||||
);
|
||||
return Array(Array.isArray(action) ? action.length : 1).fill(true);
|
||||
}
|
||||
|
||||
return (Array.isArray(action) ? action : [ action ])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue