Skip to content

Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI

582 B
Raw Blame
import { useQuery } from '@tanstack/react-query';
import { fetchOrgDetailAPI, IOrgDetailResponse, IUserOrg } from '@/lib/api/orgs';

export const orgUsersQueryKey = (orgId: string) => ['org-users', orgId];

export function useOrgUsers(orgId: string, orgDetail?: IOrgDetailResponse | null) {
  return useQuery<IUserOrg[]>({
    queryKey: orgUsersQueryKey(orgId),
    queryFn: async () => {
      if (orgDetail) {
        return orgDetail.users || [];
      }
      const detail = await fetchOrgDetailAPI(orgId);
      return detail?.users || [];
    },
    enabled: !!orgId,
  });
}