kwikid-forms 0.3.15 → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5441,7 +5441,7 @@ class KwikIDFormViewComponent {
5441
5441
  api = yield apis.validateRequestHeaders();
5442
5442
  api = yield apis.setRequestBody();
5443
5443
  api = yield apis.validateRequestBody();
5444
- let apiCallResponse = undefined;
5444
+ let apiCallResponse = {};
5445
5445
  if (api.request.body.validation.is_valid &&
5446
5446
  api.request.headers.validation.is_valid) {
5447
5447
  if (api.request.url.hasOwnProperty("type") &&
@@ -5457,12 +5457,31 @@ class KwikIDFormViewComponent {
5457
5457
  const method = (_b = (_a = api.request) === null || _a === void 0 ? void 0 : _a.method) !== null && _b !== void 0 ? _b : "POST";
5458
5458
  const headers = Object.assign({ "Content-Type": "application/json" }, (((_d = (_c = api.request) === null || _c === void 0 ? void 0 : _c.headers) === null || _d === void 0 ? void 0 : _d.value) || {}));
5459
5459
  const body = (_g = (_f = (_e = api.request) === null || _e === void 0 ? void 0 : _e.body) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : null;
5460
- const response = yield fetch(url, {
5461
- method: method,
5462
- headers: Object.assign({}, headers),
5463
- body: JSON.stringify(body)
5464
- });
5465
- apiCallResponse = yield response.json();
5460
+ if (method === "GET") {
5461
+ try {
5462
+ const response = yield fetch(url, {
5463
+ method: method,
5464
+ headers: Object.assign({}, headers)
5465
+ });
5466
+ apiCallResponse = yield response.json();
5467
+ }
5468
+ catch (err) {
5469
+ apiCallResponse = {};
5470
+ }
5471
+ }
5472
+ else {
5473
+ try {
5474
+ const response = yield fetch(url, {
5475
+ method: method,
5476
+ headers: Object.assign({}, headers),
5477
+ body: JSON.stringify(body)
5478
+ });
5479
+ apiCallResponse = yield response.json();
5480
+ }
5481
+ catch (err) {
5482
+ apiCallResponse = {};
5483
+ }
5484
+ }
5466
5485
  }
5467
5486
  api.response = setValueToObjectPath(api.response, "value", apiCallResponse);
5468
5487
  }