mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
30 lines
688 B
TypeScript
30 lines
688 B
TypeScript
import {useApiQuery} from 'sentry/utils/queryClient';
|
|
import useOrganization from 'sentry/utils/useOrganization';
|
|
|
|
export type IssueCounts = {string: number};
|
|
|
|
export function useIssueCounts(eventView, transactions) {
|
|
const organization = useOrganization();
|
|
|
|
const queryParameters = {
|
|
query: transactions,
|
|
project: eventView.project,
|
|
start: eventView.start,
|
|
end: eventView.end,
|
|
statsPeriod: eventView.statsPeriod,
|
|
};
|
|
|
|
return useApiQuery<IssueCounts[]>(
|
|
[
|
|
`/organizations/${organization.slug}/issues-count/`,
|
|
{
|
|
query: queryParameters,
|
|
},
|
|
],
|
|
{
|
|
staleTime: Infinity,
|
|
enabled: transactions.length > 0,
|
|
}
|
|
);
|
|
}
|