diff --git a/apps/web/components/Contexts/OrgContext.tsx b/apps/web/components/Contexts/OrgContext.tsx index 24604047..1362cb45 100644 --- a/apps/web/components/Contexts/OrgContext.tsx +++ b/apps/web/components/Contexts/OrgContext.tsx @@ -4,6 +4,7 @@ import { swrFetcher } from '@services/utils/ts/requests' import React, { useContext, useEffect } from 'react' import useSWR from 'swr' import { createContext } from 'react' +import { useRouter } from 'next/navigation' export const OrgContext = createContext({}) as any @@ -15,7 +16,17 @@ export function OrgProvider({ orgslug: string }) { const { data: org } = useSWR(`${getAPIUrl()}orgs/slug/${orgslug}`, swrFetcher) - useEffect(() => {}, [org]) + const router = useRouter() + // Check if Org is Active + const verifyIfOrgIsActive = () => { + if (org && org?.config.config.GeneralConfig.active === false) { + router.push('/404') + } + + } + useEffect(() => { + verifyIfOrgIsActive() + }, [org]) return {children} }