sentryApps.tsx 809 B

1234567891011121314151617181920212223242526272829303132
  1. import {
  2. addErrorMessage,
  3. addLoadingMessage,
  4. addSuccessMessage,
  5. clearIndicators,
  6. } from 'sentry/actionCreators/indicator';
  7. import type {Client} from 'sentry/api';
  8. import {t} from 'sentry/locale';
  9. import type {SentryApp} from 'sentry/types';
  10. /**
  11. * Remove a Sentry Application
  12. *
  13. * @param {Object} client ApiClient
  14. * @param {Object} app SentryApp
  15. */
  16. export function removeSentryApp(client: Client, app: SentryApp): Promise<undefined> {
  17. addLoadingMessage();
  18. const promise = client.requestPromise(`/sentry-apps/${app.slug}/`, {
  19. method: 'DELETE',
  20. });
  21. promise.then(
  22. () => {
  23. addSuccessMessage(t('%s successfully removed.', app.slug));
  24. },
  25. () => {
  26. clearIndicators();
  27. addErrorMessage(t('Unable to remove %s integration', app.slug));
  28. }
  29. );
  30. return promise;
  31. }