apiSentryClient.tsx 450 B

1234567891011121314151617181920212223
  1. import * as Sentry from '@sentry/react';
  2. let hub: Sentry.Hub | undefined;
  3. function init(dsn: string) {
  4. // This client is used to track all API requests that use `app/api`
  5. // This is a bit noisy so we don't want it in the main project (yet)
  6. const client = new Sentry.BrowserClient({
  7. dsn,
  8. });
  9. hub = new Sentry.Hub(client);
  10. }
  11. const run: Sentry.Hub['run'] = cb => {
  12. if (!hub) {
  13. return;
  14. }
  15. hub.run(cb);
  16. };
  17. export {init, run};