All files / src/hooks/queries useTeamQueries.ts

100% Statements 6/6
100% Branches 8/8
100% Functions 4/4
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31          261x     83x       79x             261x     83x     82x          
import { useQuery } from "@tanstack/react-query";
import { proApi } from "../../lib/api";
import { queryKeys } from "../../lib/query-keys";
 
export function useTeamMembers(proId: string | null) {
	return useQuery({
		queryKey: queryKeys.team.members(proId ?? ""),
		queryFn: async () => {
			const response = await proApi.getTeamMembers(
				proId as string,
				true,
			);
			return response.data || [];
		},
		enabled: !!proId,
	});
}
 
export function useTeamInvitations(proId: string | null) {
	return useQuery({
		queryKey: queryKeys.team.invitations(proId ?? ""),
		queryFn: async () => {
			const response = await proApi.getTeamInvitations(
				proId as string,
			);
			return response.data || [];
		},
		enabled: !!proId,
	});
}