Skip to content

Commit

Permalink
remove the need of always request for permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
guipeeix7 committed Feb 10, 2025
1 parent cee30e3 commit 01c8c2b
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/Routes/permissionProtect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,7 @@ const PermissionProtect = ({ element, actions }) => {

useEffect(() => {
const fetchRolePermissions = async () => {
if (user?.role) {
try {
const role = await getRoleById(user.role);
setUserPermissions(role?.permissions || []);
} catch (error) {
console.error("Failed to fetch role permissions:", error);
setUserPermissions([]);
}
setLoading(false);
} else {
setLoading(false);
}
setLoading(false);
};

fetchRolePermissions();
Expand Down

0 comments on commit 01c8c2b

Please sign in to comment.