Merge pull request #5263 from Budibase/public-apps-error
Don't show an error for the endpoint `/api/global/self`
This commit is contained in:
commit
8b1e09de0e
1 changed files with 9 additions and 1 deletions
|
@ -28,6 +28,7 @@ export const API = createAPIClient({
|
||||||
// Or we could check error.status and redirect to login on a 403 etc.
|
// Or we could check error.status and redirect to login on a 403 etc.
|
||||||
onError: error => {
|
onError: error => {
|
||||||
const { status, method, url, message, handled } = error || {}
|
const { status, method, url, message, handled } = error || {}
|
||||||
|
const ignoreErrorUrls = ["analytics", "/api/global/self"]
|
||||||
|
|
||||||
// Log any errors that we haven't manually handled
|
// Log any errors that we haven't manually handled
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
|
@ -39,7 +40,14 @@ export const API = createAPIClient({
|
||||||
if (message) {
|
if (message) {
|
||||||
// Don't notify if the URL contains the word analytics as it may be
|
// Don't notify if the URL contains the word analytics as it may be
|
||||||
// blocked by browser extensions
|
// 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)
|
notificationStore.actions.error(message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue