fix: remove invalid lowercase employee role comparisons
Remove invalid comparisons against lowercase 'employee' role that don't exist in the User type. The role type only includes uppercase 'EMPLOYEE'. Fixed in: - app/employe/dashboard/page.tsx (lines 42, 117) - app/employe/layout.tsx (lines 28, 48) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f168f24072
commit
84d42132ad
|
|
@ -39,7 +39,7 @@ export default function EmployeDashboardPage() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAuthenticated && user?.role !== 'EMPLOYEE' && user?.role !== 'employee') {
|
if (isAuthenticated && user?.role !== 'EMPLOYEE') {
|
||||||
router.push(ROUTES.HOME);
|
router.push(ROUTES.HOME);
|
||||||
toast.error('Accès refusé : rôle employé requis');
|
toast.error('Accès refusé : rôle employé requis');
|
||||||
return;
|
return;
|
||||||
|
|
@ -114,7 +114,7 @@ export default function EmployeDashboardPage() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAuthenticated || (user?.role !== 'EMPLOYEE' && user?.role !== 'employee')) {
|
if (!isAuthenticated || user?.role !== 'EMPLOYEE') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export default function EmployeLayout({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAuthenticated && user?.role !== "EMPLOYEE" && user?.role !== "employee") {
|
if (isAuthenticated && user?.role !== "EMPLOYEE") {
|
||||||
router.push("/");
|
router.push("/");
|
||||||
toast.error("Accès refusé : rôle employé requis");
|
toast.error("Accès refusé : rôle employé requis");
|
||||||
return;
|
return;
|
||||||
|
|
@ -45,7 +45,7 @@ export default function EmployeLayout({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAuthenticated || (user?.role !== "EMPLOYEE" && user?.role !== "employee")) {
|
if (!isAuthenticated || user?.role !== "EMPLOYEE") {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user