mirror of
https://github.com/hanzo-apps/dataroom.git
synced 2026-10-30 14:47:36 +00:00
24 lines
470 B
TypeScript
24 lines
470 B
TypeScript
import { useTeam } from "@/context/team-context";
|
|
import useSWR from "swr";
|
|
|
|
import { TeamDetail } from "@/lib/types";
|
|
import { fetcher } from "@/lib/utils";
|
|
|
|
export function useGetTeam() {
|
|
const { currentTeamId } = useTeam();
|
|
|
|
const { data: team, error } = useSWR<TeamDetail>(
|
|
currentTeamId && `/api/teams/${currentTeamId}`,
|
|
fetcher,
|
|
{
|
|
dedupingInterval: 20000,
|
|
},
|
|
);
|
|
|
|
return {
|
|
team,
|
|
loading: team ? false : true,
|
|
error,
|
|
};
|
|
}
|