diff --git a/src/app/(main)/teams/[teamId]/Team.tsx b/src/app/(main)/teams/[teamId]/Team.tsx new file mode 100644 index 00000000..631fdaf1 --- /dev/null +++ b/src/app/(main)/teams/[teamId]/Team.tsx @@ -0,0 +1,21 @@ +'use client'; +import { useTeam, useTeamContext } from 'components/hooks'; +import { Loading } from 'react-basics'; +import notFound from 'app/not-found'; + +export function Team({ children }) { + const { teamId } = useTeamContext(); + const { data: team, isLoading } = useTeam(teamId); + + if (isLoading) { + return ; + } + + if (!team) { + return notFound(); + } + + return children; +} + +export default Team; diff --git a/src/app/(main)/teams/[teamId]/layout.tsx b/src/app/(main)/teams/[teamId]/layout.tsx new file mode 100644 index 00000000..1f887ce8 --- /dev/null +++ b/src/app/(main)/teams/[teamId]/layout.tsx @@ -0,0 +1,5 @@ +import Team from './Team'; + +export default function ({ children }) { + return {children}; +}