16 lines
678 B
TypeScript
16 lines
678 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { useInject } from '@/lib/di/hooks/useInject';
|
|
import { TEAM_JOIN_SERVICE_TOKEN } from '@/lib/di/tokens';
|
|
import { enhanceQueryResult } from '@/lib/di/hooks/useReactQueryWithApiError';
|
|
|
|
export function useTeamJoinRequests(teamId: string, currentUserId: string, isOwner: boolean) {
|
|
const teamJoinService = useInject(TEAM_JOIN_SERVICE_TOKEN);
|
|
|
|
const queryResult = useQuery({
|
|
queryKey: ['teamJoinRequests', teamId, currentUserId, isOwner],
|
|
queryFn: () => teamJoinService.getJoinRequests(teamId, currentUserId, isOwner),
|
|
enabled: !!teamId && !!currentUserId,
|
|
});
|
|
|
|
return enhanceQueryResult(queryResult);
|
|
} |