@servicetitan/ajax-handlers
Advanced tools
Comparing version 22.9.0 to 22.10.0
@@ -21,12 +21,12 @@ import axios from 'axios'; | ||
const showError = (error) => { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r; | ||
const isHardError = !!((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.harderror); | ||
let message = (_h = (_f = (_e = (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.Error) === null || _e === void 0 ? void 0 : _e.Message) !== null && _f !== void 0 ? _f : (_g = error.response) === null || _g === void 0 ? void 0 : _g.headers['x-message']) !== null && _h !== void 0 ? _h : (_j = error.response) === null || _j === void 0 ? void 0 : _j.statusText; | ||
let message = (_j = (_f = (_e = (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.Error) === null || _e === void 0 ? void 0 : _e.Message) !== null && _f !== void 0 ? _f : (_h = (_g = error.response) === null || _g === void 0 ? void 0 : _g.headers) === null || _h === void 0 ? void 0 : _h['x-message']) !== null && _j !== void 0 ? _j : (_k = error.response) === null || _k === void 0 ? void 0 : _k.statusText; | ||
if (!message) { | ||
message = typeof error === 'string' ? error : 'Error'; | ||
} | ||
const isConnectionError = !((_k = error.response) === null || _k === void 0 ? void 0 : _k.status); | ||
const isConnectionError = !((_l = error.response) === null || _l === void 0 ? void 0 : _l.status); | ||
if (isHardError) { | ||
const isReportable = ((_o = (_m = (_l = error.response) === null || _l === void 0 ? void 0 : _l.headers) === null || _m === void 0 ? void 0 : _m.isreportable) === null || _o === void 0 ? void 0 : _o.trim()) === 'true'; | ||
(_p = notifier === null || notifier === void 0 ? void 0 : notifier.show) === null || _p === void 0 ? void 0 : _p.call(notifier, { | ||
const isReportable = ((_p = (_o = (_m = error.response) === null || _m === void 0 ? void 0 : _m.headers) === null || _o === void 0 ? void 0 : _o.isreportable) === null || _p === void 0 ? void 0 : _p.trim()) === 'true'; | ||
(_q = notifier === null || notifier === void 0 ? void 0 : notifier.show) === null || _q === void 0 ? void 0 : _q.call(notifier, { | ||
status: Status.Error, | ||
@@ -56,3 +56,3 @@ title: 'Application error', | ||
else { | ||
(_q = notifier === null || notifier === void 0 ? void 0 : notifier.show) === null || _q === void 0 ? void 0 : _q.call(notifier, { | ||
(_r = notifier === null || notifier === void 0 ? void 0 : notifier.show) === null || _r === void 0 ? void 0 : _r.call(notifier, { | ||
status: Status.Warning, | ||
@@ -59,0 +59,0 @@ title: 'Action cancelled', |
{ | ||
"name": "@servicetitan/ajax-handlers", | ||
"version": "22.9.0", | ||
"version": "22.10.0", | ||
"description": "", | ||
@@ -21,3 +21,3 @@ "repository": { | ||
"devDependencies": { | ||
"@servicetitan/react-ioc": "22.9.0", | ||
"@servicetitan/react-ioc": "22.10.0", | ||
"@types/jquery": "~2.0.57", | ||
@@ -30,3 +30,3 @@ "@types/js-cookie": "~3.0.3", | ||
"peerDependencies": { | ||
"@servicetitan/react-ioc": "22.9.0", | ||
"@servicetitan/react-ioc": "22.10.0", | ||
"axios": "~0.27.2", | ||
@@ -42,3 +42,3 @@ "jquery": "~2.1.4", | ||
}, | ||
"gitHead": "dd3998da00a372c76f087e6f4472951555f29b3b" | ||
"gitHead": "07666ca3d83bc5ed38d8ca2e82744fef338e4eca" | ||
} |
@@ -33,3 +33,3 @@ import axios, { AxiosError } from 'axios'; | ||
error.response?.data?.Error?.Message ?? | ||
error.response?.headers['x-message'] ?? | ||
error.response?.headers?.['x-message'] ?? | ||
error.response?.statusText; | ||
@@ -36,0 +36,0 @@ if (!message) { |
Sorry, the diff of this file is not supported yet
53676