import { LOCAL_STORAGE_KEYS } from 'common' import { useRouter } from 'next/router' import { useEffect } from 'react' import { ShimmeringCard } from '@/components/interfaces/Home/ProjectList/ShimmeringCard' import { DefaultLayout } from '@/components/layouts/DefaultLayout' import OrganizationLayout from '@/components/layouts/OrganizationLayout' import { ScaffoldContainerLegacy } from '@/components/layouts/Scaffold' import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage' import type { NextPageWithLayout } from '@/types' const OrgIndexPage: NextPageWithLayout = () => { const router = useRouter() const [lastVisitedOrganization, _, { isSuccess }] = useLocalStorageQuery( LOCAL_STORAGE_KEYS.LAST_VISITED_ORGANIZATION, '' ) useEffect(() => { if (isSuccess) { if (lastVisitedOrganization.length > 0) router.push(`/org/${lastVisitedOrganization}`) else router.push('/organizations') } // eslint-disable-next-line react-hooks/exhaustive-deps }, [isSuccess]) return (
) } OrgIndexPage.getLayout = (page) => ( {page} ) export default OrgIndexPage