@treely/strapi-slices 5.6.0 → 5.8.0
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.
- package/dist/integrations/strapi/getPortfolioProjects.d.ts +1 -1
- package/dist/integrations/strapi/getStaticPropsFromStrapi.d.ts +2 -1
- package/dist/strapi-slices.cjs.development.js +26 -16
- package/dist/strapi-slices.cjs.development.js.map +1 -1
- package/dist/strapi-slices.cjs.production.min.js +1 -1
- package/dist/strapi-slices.cjs.production.min.js.map +1 -1
- package/dist/strapi-slices.esm.js +26 -16
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/integrations/strapi/getPortfolioProjects.ts +13 -6
- package/src/integrations/strapi/getStaticPropsFromStrapi.test.ts +16 -0
- package/src/integrations/strapi/getStaticPropsFromStrapi.ts +5 -4
|
@@ -411,20 +411,30 @@ var strapiClient = /*#__PURE__*/setupCache( /*#__PURE__*/axios.create({
|
|
|
411
411
|
}));
|
|
412
412
|
|
|
413
413
|
var getPortfolioProjects = /*#__PURE__*/function () {
|
|
414
|
-
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(locale) {
|
|
415
|
-
var _yield$Promise$all, fpmProjects, strapiProjects;
|
|
414
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(locale, preview) {
|
|
415
|
+
var params, _yield$Promise$all, fpmProjects, strapiProjects;
|
|
416
416
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
417
417
|
while (1) switch (_context.prev = _context.next) {
|
|
418
418
|
case 0:
|
|
419
|
-
|
|
419
|
+
if (locale === void 0) {
|
|
420
|
+
locale = 'en';
|
|
421
|
+
}
|
|
422
|
+
if (preview === void 0) {
|
|
423
|
+
preview = false;
|
|
424
|
+
}
|
|
425
|
+
params = {
|
|
426
|
+
populate: 'deep,6',
|
|
427
|
+
locale: locale,
|
|
428
|
+
'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE
|
|
429
|
+
};
|
|
430
|
+
if (preview) {
|
|
431
|
+
params.publicationState = 'preview';
|
|
432
|
+
}
|
|
433
|
+
_context.next = 6;
|
|
420
434
|
return Promise.all([fpmClient.get('/public/projects'), strapiClient.get('/projects', {
|
|
421
|
-
params:
|
|
422
|
-
populate: 'deep,6',
|
|
423
|
-
locale: locale,
|
|
424
|
-
'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE
|
|
425
|
-
}
|
|
435
|
+
params: params
|
|
426
436
|
})]);
|
|
427
|
-
case
|
|
437
|
+
case 6:
|
|
428
438
|
_yield$Promise$all = _context.sent;
|
|
429
439
|
fpmProjects = _yield$Promise$all[0].data;
|
|
430
440
|
strapiProjects = _yield$Promise$all[1].data;
|
|
@@ -451,13 +461,13 @@ var getPortfolioProjects = /*#__PURE__*/function () {
|
|
|
451
461
|
}
|
|
452
462
|
return toReturn;
|
|
453
463
|
}));
|
|
454
|
-
case
|
|
464
|
+
case 10:
|
|
455
465
|
case "end":
|
|
456
466
|
return _context.stop();
|
|
457
467
|
}
|
|
458
468
|
}, _callee);
|
|
459
469
|
}));
|
|
460
|
-
return function getPortfolioProjects(_x) {
|
|
470
|
+
return function getPortfolioProjects(_x, _x2) {
|
|
461
471
|
return _ref.apply(this, arguments);
|
|
462
472
|
};
|
|
463
473
|
}();
|
|
@@ -492,20 +502,20 @@ var getStaticPathsFromStrapi = /*#__PURE__*/function () {
|
|
|
492
502
|
|
|
493
503
|
var getStaticPropsFromStrapi = /*#__PURE__*/function () {
|
|
494
504
|
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, _ref) {
|
|
495
|
-
var _ref$locale, locale, slug, _ref$preview, preview, filters, params;
|
|
505
|
+
var _ref$locale, locale, slug, _ref$preview, preview, _ref$filters, filters, enrichedFilters, params;
|
|
496
506
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
497
507
|
while (1) switch (_context.prev = _context.next) {
|
|
498
508
|
case 0:
|
|
499
|
-
_ref$locale = _ref.locale, locale = _ref$locale === void 0 ? 'en' : _ref$locale, slug = _ref.slug, _ref$preview = _ref.preview, preview = _ref$preview === void 0 ? false : _ref$preview;
|
|
500
|
-
|
|
509
|
+
_ref$locale = _ref.locale, locale = _ref$locale === void 0 ? 'en' : _ref$locale, slug = _ref.slug, _ref$preview = _ref.preview, preview = _ref$preview === void 0 ? false : _ref$preview, _ref$filters = _ref.filters, filters = _ref$filters === void 0 ? {} : _ref$filters;
|
|
510
|
+
enrichedFilters = filters;
|
|
501
511
|
if (slug) {
|
|
502
|
-
|
|
512
|
+
enrichedFilters.slug = slug;
|
|
503
513
|
}
|
|
504
514
|
params = {
|
|
505
515
|
populate: 'deep,6',
|
|
506
516
|
locale: locale,
|
|
507
517
|
'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
|
|
508
|
-
filters:
|
|
518
|
+
filters: enrichedFilters
|
|
509
519
|
};
|
|
510
520
|
if (preview) {
|
|
511
521
|
params.publicationState = 'preview';
|