fix: remove invalid role comparisons in admin page
Remove lowercase 'admin' role checks that don't exist in the User type. The role type is 'CLIENT' | 'EMPLOYEE' | 'ADMIN', so comparing against lowercase 'admin' causes TypeScript compilation errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ce575653f7
commit
e422f13bed
|
|
@ -15,14 +15,14 @@ export default function AdminPage() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAuthenticated && user?.role !== "ADMIN" && user?.role !== "admin") {
|
if (isAuthenticated && user?.role !== "ADMIN") {
|
||||||
router.push("/");
|
router.push("/");
|
||||||
toast.error("Accès refusé : rôle administrateur requis");
|
toast.error("Accès refusé : rôle administrateur requis");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect to dashboard
|
// Redirect to dashboard
|
||||||
if (isAuthenticated && (user?.role === "ADMIN" || user?.role === "admin")) {
|
if (isAuthenticated && user?.role === "ADMIN") {
|
||||||
router.push("/admin/dashboard");
|
router.push("/admin/dashboard");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user