Skip to content

Commit

Permalink
Recalculate pagePermission after fetching liaisonUsers
Browse files Browse the repository at this point in the history
  • Loading branch information
rlho committed Nov 7, 2024
1 parent 7f667cb commit 8e6b081
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,18 @@ export const DatabaseProvider = ({
if (!userEmail) return PagePermission.BOOKING;
if (adminUsers.map((admin) => admin.email).includes(userEmail))
return PagePermission.ADMIN;
console.log("liaisonUsers", liaisonUsers);
console.log("userEmail", userEmail);
console.log(
"liaisonUsers.map((liaison) => liaison.email).includes(userEmail)",
liaisonUsers.map((liaison) => liaison.email).includes(userEmail)
);
if (liaisonUsers.map((liaison) => liaison.email).includes(userEmail)) {
return PagePermission.LIAISON;
} else if (paUsers.map((pa) => pa.email).includes(userEmail))
return PagePermission.PA;
else return PagePermission.BOOKING;
}, [userEmail, adminUsers, paUsers]);
}, [userEmail, adminUsers, paUsers, liaisonUsers]);
console.log("pagePermission", pagePermission);

useEffect(() => {
Expand Down

0 comments on commit 8e6b081

Please sign in to comment.