@servicetitan/ajax-handlers
Advanced tools
Comparing version 12.4.0 to 12.6.0
@@ -87,3 +87,3 @@ "use strict"; | ||
}, error => { | ||
var _a, _b, _c, _d, _e, _f; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
if (!((_a = error.config) === null || _a === void 0 ? void 0 : _a.hideGlobalLoader)) { | ||
@@ -99,5 +99,7 @@ loader_1.loader.hide(); | ||
} | ||
if (!((_c = error.config) === null || _c === void 0 ? void 0 : _c.suppressShowError)) { | ||
if (!((_c = error.config) === null || _c === void 0 ? void 0 : _c.suppressShowError) || | ||
(Array.isArray((_d = error.config) === null || _d === void 0 ? void 0 : _d.suppressShowError) && | ||
!((_e = error.config) === null || _e === void 0 ? void 0 : _e.suppressShowError.includes((_f = error.response) === null || _f === void 0 ? void 0 : _f.status)))) { | ||
const isFiltered = errorFilteredUrls.some(url => { var _a, _b; return (_b = (_a = error.config) === null || _a === void 0 ? void 0 : _a.url) === null || _b === void 0 ? void 0 : _b.startsWith(url); }); | ||
const isCodedException = !!((_f = (_e = (_d = error.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.Error) === null || _f === void 0 ? void 0 : _f.Code); | ||
const isCodedException = !!((_j = (_h = (_g = error.response) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h.Error) === null || _j === void 0 ? void 0 : _j.Code); | ||
const isAborted = typeof error === 'string' && error === 'abort'; | ||
@@ -104,0 +106,0 @@ if (!isFiltered && !isCodedException && !isAborted) { |
declare module 'axios' { | ||
interface AxiosRequestConfig { | ||
suppressShowError?: boolean; | ||
/** | ||
* Disables global error notification. | ||
* Pass integer error codes to disable notification for specified status codes. | ||
* Example: [401] disables error notification for Unauthorized response. | ||
*/ | ||
suppressShowError?: boolean | number[]; | ||
hideGlobalLoader?: boolean; | ||
@@ -5,0 +10,0 @@ } |
{ | ||
"name": "@servicetitan/ajax-handlers", | ||
"version": "12.4.0", | ||
"version": "12.6.0", | ||
"description": "", | ||
@@ -34,3 +34,3 @@ "repository": { | ||
}, | ||
"gitHead": "e19d020a294c67718a8c6eef427264c1d21606bf" | ||
"gitHead": "f8455f5f057452056d1ac0c278da24947b578d35" | ||
} |
@@ -120,3 +120,7 @@ import axios, { AxiosError } from 'axios'; | ||
if (!error.config?.suppressShowError) { | ||
if ( | ||
!error.config?.suppressShowError || | ||
(Array.isArray(error.config?.suppressShowError) && | ||
!error.config?.suppressShowError.includes(error.response?.status)) | ||
) { | ||
const isFiltered = errorFilteredUrls.some(url => | ||
@@ -123,0 +127,0 @@ error.config?.url?.startsWith(url) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37141
674