Waits for session data before redirecting
parent
1c2c6a62e6
commit
e09dd04e7f
|
@ -16,7 +16,7 @@ export default function AdminLayout({
|
||||||
|
|
||||||
// Force redirect on component level
|
// Force redirect on component level
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (session.data?.user.role !== UserPermissionRole.ADMIN) {
|
if (session.data && session.data.user.role !== UserPermissionRole.ADMIN) {
|
||||||
router.replace("/settings");
|
router.replace("/settings");
|
||||||
}
|
}
|
||||||
}, [session, router]);
|
}, [session, router]);
|
||||||
|
|
Loading…
Reference in New Issue