Skip to content

Commit

Permalink
fix: Linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
josebui committed Aug 29, 2023
1 parent 115a2b7 commit 16b33b7
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/permissions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ const defaultBehaviour = {
export const PermissionsContext = React.createContext(defaultBehaviour);

export const PermissionsProvider = ({ rules, children }) => {
const isAllowedTo = useCallback((permission, user, resource) => {
const ruleResolver = _.getOr(
defaultBehaviour.isAllowedTo,
permission,
rules
);
return !resource
? false
: ruleResolver({ user, resource });
}, []);
const isAllowedTo = useCallback(
(permission, user, resource) => {
const ruleResolver = _.getOr(
defaultBehaviour.isAllowedTo,
permission,
rules
);
return !resource ? false : ruleResolver({ user, resource });
},
[rules]
);

return (
<PermissionsContext.Provider value={isAllowedTo}>
Expand Down

0 comments on commit 16b33b7

Please sign in to comment.