useEventDetails.tsx 589 B

123456789101112131415161718
  1. import {EventTransaction} from 'sentry/types';
  2. import {useApiQuery} from 'sentry/utils/queryClient';
  3. import useOrganization from 'sentry/utils/useOrganization';
  4. interface Props {
  5. eventId?: EventTransaction['id'];
  6. projectSlug?: string;
  7. }
  8. export function useEventDetails(props: Props) {
  9. const organization = useOrganization();
  10. const {eventId, projectSlug} = props;
  11. return useApiQuery<EventTransaction>(
  12. [`/organizations/${organization.slug}/events/${projectSlug}:${eventId}/`],
  13. {staleTime: Infinity, enabled: Boolean(eventId && projectSlug && organization.slug)}
  14. );
  15. }