Skip to content

Commit

Permalink
Simplify useCanAccessResources
Browse files Browse the repository at this point in the history
  • Loading branch information
React-Admin CI committed Nov 20, 2024
1 parent d30bc7c commit fffec2c
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions packages/ra-core/src/auth/useCanAccessResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,14 @@ export const useCanAccessResources = <
})
);

const canAccessMap = queries.reduce(
const result = queries.reduce(
(acc, { resource, canAccess }) => {
acc[resource] = canAccess;
return acc;
},
{} as Record<string, boolean>
);

const result = resources.reduce(
(acc, resource) => ({
...acc,
[resource]: canAccessMap[resource],
}),
{} as Record<string, boolean>
);

return result;
},
...options,
Expand Down

0 comments on commit fffec2c

Please sign in to comment.