usePromotionTriggerCheck.tsx 629 B

123456789101112131415161718
  1. import type {Organization} from 'sentry/types/organization';
  2. import {type ApiQueryKey, useApiQuery} from 'sentry/utils/queryClient';
  3. import type {PromotionData} from 'getsentry/types';
  4. export function createPromotionCheckQueryKey(orgSlug: string): ApiQueryKey {
  5. return [`/organizations/${orgSlug}/promotions/trigger-check/`, {method: 'POST'}];
  6. }
  7. /**
  8. * Initiates a promotion trigger check for the organization
  9. */
  10. export default function usePromotionTriggerCheck(organization: Organization) {
  11. return useApiQuery<PromotionData>(createPromotionCheckQueryKey(organization.slug), {
  12. staleTime: 10000,
  13. retry: 0,
  14. });
  15. }