useReleases.tsx 665 B

12345678910111213141516171819202122232425
  1. import {Release} from 'sentry/types';
  2. import {useApiQuery} from 'sentry/utils/queryClient';
  3. import useOrganization from 'sentry/utils/useOrganization';
  4. import usePageFilters from 'sentry/utils/usePageFilters';
  5. export function useReleases() {
  6. const organization = useOrganization();
  7. const {selection} = usePageFilters();
  8. const {environments, projects} = selection;
  9. return useApiQuery<Release[]>(
  10. [
  11. `/organizations/${organization.slug}/releases/`,
  12. {
  13. query: {
  14. sort: 'date',
  15. project: projects,
  16. per_page: 50,
  17. environment: environments,
  18. },
  19. },
  20. ],
  21. {staleTime: Infinity}
  22. );
  23. }