useFeedbackHasScreenshot.tsx 651 B

123456789101112131415161718192021222324252627
  1. import {useMemo} from 'react';
  2. import {useFetchEventAttachments} from 'sentry/actionCreators/events';
  3. import type {Event} from 'sentry/types/event';
  4. import useOrganization from 'sentry/utils/useOrganization';
  5. interface Props {
  6. event: Event;
  7. projectSlug: string;
  8. }
  9. export default function useFeedbackScreenshot({projectSlug, event}: Props) {
  10. const organization = useOrganization();
  11. const {data: attachments} = useFetchEventAttachments({
  12. orgSlug: organization.slug,
  13. projectSlug,
  14. eventId: event.id,
  15. });
  16. const screenshots = useMemo(() => {
  17. return attachments ?? [];
  18. }, [attachments]);
  19. return {
  20. screenshots,
  21. };
  22. }