1234567891011121314151617181920212223242526 |
- import {SavedSearch} from 'sentry/types';
- import {useApiQuery, UseApiQueryOptions} 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,
- }
- );
- };
|