diff --git a/apps/web-admin/src/pages/index.jsx b/apps/web-admin/src/pages/index.jsx index f5ebf773..599c9979 100644 --- a/apps/web-admin/src/pages/index.jsx +++ b/apps/web-admin/src/pages/index.jsx @@ -14,11 +14,17 @@ function Dashboard() { const router = useRouter(); const { user, isAuthenticated, isLoading, loginWithRedirect } = useAuth0(); const { accountDetails } = useContext(account); - // useEffect(() => { - // if (isAuthenticated) { - // router.push(`/${accountDetails.orgId}/events`); - // } - // }, [router.pathname]); + useEffect(() => { + console.log(accountDetails); + if ( + accountDetails && + accountDetails.orgId && + router.asPath !== `/${accountDetails.orgId}/events` + ) { + // // //console.log('route') + router.replace(`/${accountDetails.orgId}/events`); + } + }, [isAuthenticated, accountDetails]); return {!isAuthenticated && }; }