Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

470 B
Raw Blame
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,
  };
}