@plaidev/karte-action-sdk 1.1.206-28212827.fab6eaf0 → 1.1.206-28212859.21a77059

Sign up to get free protection for your applications and to get access to all the features.
@@ -1324,11 +1324,18 @@ function request(url, data, cb) {
1324
1324
  'Content-Type': 'text/plain;charset=UTF-8',
1325
1325
  },
1326
1326
  body: JSON.stringify({ ...data }),
1327
- }).then(response => {
1327
+ })
1328
+ .then(response => {
1328
1329
  if (!response.ok) {
1329
- return cb(new Error(`fail to request collection api. reason: ${response.status}`));
1330
+ throw new Error(`fail to request collection api. reason: ${response.status}`);
1330
1331
  }
1331
- return cb(null, response.json());
1332
+ return response.json();
1333
+ })
1334
+ .then(data => {
1335
+ return cb(null, data);
1336
+ })
1337
+ .catch(err => {
1338
+ return cb(err, null);
1332
1339
  });
1333
1340
  }
1334
1341
  /** @internal */
package/dist/index.es.js CHANGED
@@ -1347,11 +1347,18 @@ function request(url, data, cb) {
1347
1347
  'Content-Type': 'text/plain;charset=UTF-8',
1348
1348
  },
1349
1349
  body: JSON.stringify({ ...data }),
1350
- }).then(response => {
1350
+ })
1351
+ .then(response => {
1351
1352
  if (!response.ok) {
1352
- return cb(new Error(`fail to request collection api. reason: ${response.status}`));
1353
+ throw new Error(`fail to request collection api. reason: ${response.status}`);
1353
1354
  }
1354
- return cb(null, response.json());
1355
+ return response.json();
1356
+ })
1357
+ .then(data => {
1358
+ return cb(null, data);
1359
+ })
1360
+ .catch(err => {
1361
+ return cb(err, null);
1355
1362
  });
1356
1363
  }
1357
1364
  /** @internal */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.206-28212827.fab6eaf0",
3
+ "version": "1.1.206-28212859.21a77059",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",