Handle when team not found.

This commit is contained in:
Mike Cao 2024-02-02 22:30:01 -08:00
parent 238e6efee2
commit bb0504065b
2 changed files with 26 additions and 0 deletions

View File

@ -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 <Loading />;
}
if (!team) {
return notFound();
}
return children;
}
export default Team;

View File

@ -0,0 +1,5 @@
import Team from './Team';
export default function ({ children }) {
return <Team>{children}</Team>;
}