From 3c3be6678623a992becb79d54afbd15aaa0bb1bd Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 6 Apr 2022 08:16:24 +0100 Subject: [PATCH] Don't show an error for the endpoint --- packages/client/src/api/api.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/client/src/api/api.js b/packages/client/src/api/api.js index 591d4a6782..35730ac9b7 100644 --- a/packages/client/src/api/api.js +++ b/packages/client/src/api/api.js @@ -28,6 +28,7 @@ export const API = createAPIClient({ // Or we could check error.status and redirect to login on a 403 etc. onError: error => { const { status, method, url, message, handled } = error || {} + const ignoreErrorUrls = ["analytics", "/api/global/self"] // Log any errors that we haven't manually handled if (!handled) { @@ -39,7 +40,14 @@ export const API = createAPIClient({ if (message) { // Don't notify if the URL contains the word analytics as it may be // blocked by browser extensions - if (!url?.includes("analytics")) { + let ignore = false + for (let ignoreUrl of ignoreErrorUrls) { + if (url?.includes(ignoreUrl)) { + ignore = true + break + } + } + if (!ignore) { notificationStore.actions.error(message) } }