Waits for session data before redirecting

pull/5657/head^2
zomars 2022-11-23 14:54:17 -07:00
parent 1c2c6a62e6
commit e09dd04e7f
1 changed files with 1 additions and 1 deletions

View File

@ -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]);