apollo-link-sentry
Version:
[Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction) to enrich [Sentry](https://sentry.io) events with [GraphQL](https://graphql.org) data
19 lines (18 loc) • 544 B
JavaScript
export const excludeGraphQLFetch = (breadcrumb) => {
if (breadcrumb.category === 'fetch') {
const url = breadcrumb.data?.url ?? '';
if (url.includes('/graphql')) {
return null;
}
}
return breadcrumb;
};
export function withoutGraphQLFetch(beforeBreadcrumb) {
return (breadcrumb, hint) => {
const withoutFetch = excludeGraphQLFetch(breadcrumb, hint);
if (withoutFetch === null) {
return null;
}
return beforeBreadcrumb(withoutFetch, hint);
};
}