mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
28 lines
802 B
TypeScript
28 lines
802 B
TypeScript
import type {SavedSearch} from 'sentry/types';
|
|
import type {UseApiQueryOptions} from 'sentry/utils/queryClient';
|
|
import {useApiQuery} from 'sentry/utils/queryClient';
|
|
|
|
type FetchSavedSearchesForOrgParameters = {
|
|
orgSlug: string;
|
|
};
|
|
|
|
type FetchSavedSearchesForOrgResponse = SavedSearch[];
|
|
|
|
export const makeFetchSavedSearchesForOrgQueryKey = ({
|
|
orgSlug,
|
|
}: FetchSavedSearchesForOrgParameters) =>
|
|
[`/organizations/${orgSlug}/searches/`] as const;
|
|
|
|
export const useFetchSavedSearchesForOrg = (
|
|
{orgSlug}: FetchSavedSearchesForOrgParameters,
|
|
options: Partial<UseApiQueryOptions<FetchSavedSearchesForOrgResponse>> = {}
|
|
) => {
|
|
return useApiQuery<FetchSavedSearchesForOrgResponse>(
|
|
makeFetchSavedSearchesForOrgQueryKey({orgSlug}),
|
|
{
|
|
staleTime: 30000,
|
|
...options,
|
|
}
|
|
);
|
|
};
|