mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
38 lines
937 B
TypeScript
38 lines
937 B
TypeScript
import type {Committer} from 'sentry/types';
|
|
import type {ApiQueryKey, UseApiQueryOptions} from 'sentry/utils/queryClient';
|
|
import {useApiQuery} from 'sentry/utils/queryClient';
|
|
|
|
import useOrganization from './useOrganization';
|
|
|
|
interface UseCommittersProps {
|
|
eventId: string;
|
|
projectSlug: string;
|
|
}
|
|
|
|
interface CommittersResponse {
|
|
committers: Committer[];
|
|
}
|
|
|
|
const makeCommittersQueryKey = (
|
|
orgSlug: string,
|
|
projectSlug: string,
|
|
eventId: string
|
|
): ApiQueryKey => [`/projects/${orgSlug}/${projectSlug}/events/${eventId}/committers/`];
|
|
|
|
function useCommitters(
|
|
{eventId, projectSlug}: UseCommittersProps,
|
|
options: Partial<UseApiQueryOptions<CommittersResponse>> = {}
|
|
) {
|
|
const org = useOrganization();
|
|
return useApiQuery<CommittersResponse>(
|
|
makeCommittersQueryKey(org.slug, projectSlug, eventId),
|
|
{
|
|
staleTime: Infinity,
|
|
retry: false,
|
|
...options,
|
|
}
|
|
);
|
|
}
|
|
|
|
export default useCommitters;
|