fix: Refresh par profil role

This commit is contained in:
N3WT DE COMPET
2025-05-01 14:12:21 +02:00
parent 43e301ed64
commit 24069b894e
2 changed files with 10 additions and 8 deletions

View File

@ -18,7 +18,7 @@ const ProtectedRoute = ({ children, requiredRight }) => {
hasRequiredRight,
});
if (user && profileRole) {
if (user && profileRole !== null) {
let requiredRightChecked = false;
if (requiredRight && Array.isArray(requiredRight)) {
// Vérifier si l'utilisateur a le droit requis
@ -41,7 +41,7 @@ const ProtectedRoute = ({ children, requiredRight }) => {
// User non authentifié
router.push(`${FE_USERS_LOGIN_URL}`);
}
}, [user]);
}, [user, profileRole]);
// Autoriser l'affichage si authentifié et rôle correct
return hasRequiredRight ? children : null;