Comparing version 1.0.1 to 1.0.4
@@ -44,3 +44,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var config; | ||
var config, e_1; | ||
return __generator(this, function (_a) { | ||
@@ -50,4 +50,12 @@ switch (_a.label) { | ||
config = conf_1.getConfig(); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, axios_1["default"].get(config.dataSource.url + "/" + collection)]; | ||
case 1: return [2 /*return*/, (_a.sent()).data]; | ||
case 2: return [2 /*return*/, (_a.sent()).data]; | ||
case 3: | ||
e_1 = _a.sent(); | ||
console.log("failed to retrieve data from strapi", e_1); | ||
return [2 /*return*/, null]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
@@ -54,0 +62,0 @@ }); |
{ | ||
"name": "@2fn/data", | ||
"version": "1.0.1", | ||
"version": "1.0.4", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -5,3 +5,8 @@ import axios from 'axios'; | ||
const config = getConfig(); | ||
return (await axios.get(`${config.dataSource.url}/${collection}`)).data; | ||
try { | ||
return (await axios.get(`${config.dataSource.url}/${collection}`)).data; | ||
} catch (e) { | ||
console.log(`failed to retrieve data from strapi`, e); | ||
return null; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112916
161