mts-booking-library 2.1.1 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -101,7 +101,14 @@ var makeGet = function (url, options) { return __awaiter(void 0, void 0, void 0,
101
101
  return [3 /*break*/, 3];
102
102
  case 2:
103
103
  error_1 = _j.sent();
104
- if (axios_1.default.isAxiosError(error_1)) {
104
+ if (axios_1.default.isCancel(error_1)) {
105
+ // Log cancellation
106
+ if (debug || (0, config_1.getConfig)().ENV === config_1.MTSEnvs.TEST)
107
+ console.log("GET_RequestCanceled", url);
108
+ // Resolve with empty object
109
+ resolve({});
110
+ }
111
+ else if (axios_1.default.isAxiosError(error_1)) {
105
112
  message = ((_b = (_a = error_1.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error)
106
113
  ? error_1.response.data.error.message
107
114
  : (_d = (_c = error_1.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.message;
@@ -163,7 +170,14 @@ var makePost = function (url, data, options) { return __awaiter(void 0, void 0,
163
170
  return [3 /*break*/, 3];
164
171
  case 2:
165
172
  error_2 = _j.sent();
166
- if (axios_1.default.isAxiosError(error_2)) {
173
+ if (axios_1.default.isCancel(error_2)) {
174
+ // Log cancellation
175
+ if (debug || (0, config_1.getConfig)().ENV === config_1.MTSEnvs.TEST)
176
+ console.log("POST_RequestCanceled", url);
177
+ // Resolve with empty object
178
+ resolve({});
179
+ }
180
+ else if (axios_1.default.isAxiosError(error_2)) {
167
181
  message = ((_b = (_a = error_2.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error)
168
182
  ? error_2.response.data.error.message
169
183
  : (_d = (_c = error_2.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.message;
@@ -225,7 +239,14 @@ var makePut = function (url, data, options) { return __awaiter(void 0, void 0, v
225
239
  return [3 /*break*/, 3];
226
240
  case 2:
227
241
  error_3 = _j.sent();
228
- if (axios_1.default.isAxiosError(error_3)) {
242
+ if (axios_1.default.isCancel(error_3)) {
243
+ // Log cancellation
244
+ if (debug || (0, config_1.getConfig)().ENV === config_1.MTSEnvs.TEST)
245
+ console.log("PUT_RequestCanceled", url);
246
+ // Resolve with empty object
247
+ resolve({});
248
+ }
249
+ else if (axios_1.default.isAxiosError(error_3)) {
229
250
  message = ((_b = (_a = error_3.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error)
230
251
  ? error_3.response.data.error.message
231
252
  : (_d = (_c = error_3.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.message;
@@ -287,7 +308,14 @@ var makeDelete = function (url, options) { return __awaiter(void 0, void 0, void
287
308
  return [3 /*break*/, 3];
288
309
  case 2:
289
310
  error_4 = _j.sent();
290
- if (axios_1.default.isAxiosError(error_4)) {
311
+ if (axios_1.default.isCancel(error_4)) {
312
+ // Log cancellation
313
+ if (debug || (0, config_1.getConfig)().ENV === config_1.MTSEnvs.TEST)
314
+ console.log("DELETE_RequestCanceled", url);
315
+ // Resolve with empty object
316
+ resolve({});
317
+ }
318
+ else if (axios_1.default.isAxiosError(error_4)) {
291
319
  message = ((_b = (_a = error_4.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error)
292
320
  ? error_4.response.data.error.message
293
321
  : (_d = (_c = error_4.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.message;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "Library for using MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",