Waits for session data before redirecting

This commit is contained in:
zomars committed 2022-11-23 14:55:18 -07:00
1 parent 1c2c6a62e6
commit e09dd04e7f
1 file changed
+1 -1
+1 -1
View File
@@ -16,7 +16,7 @@ export default function AdminLayout({
// Force redirect on component level
useEffect(() => {
if (session.data?.user.role !== UserPermissionRole.ADMIN) {
if (session.data && session.data.user.role !== UserPermissionRole.ADMIN) {
router.replace("/settings");
}
}, [session, router]);