@treely/strapi-slices 5.6.0 → 5.7.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/getStaticPropsFromStrapi.d.ts +2 -1
- package/dist/strapi-slices.cjs.development.js +5 -5
- 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 +5 -5
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/integrations/strapi/getStaticPropsFromStrapi.test.ts +16 -0
- package/src/integrations/strapi/getStaticPropsFromStrapi.ts +5 -4
|
@@ -3,6 +3,7 @@ interface Options {
|
|
|
3
3
|
locale?: string;
|
|
4
4
|
slug?: string;
|
|
5
5
|
preview?: boolean;
|
|
6
|
+
filters?: Record<string, any>;
|
|
6
7
|
}
|
|
7
|
-
declare const getStaticPropsFromStrapi: (path: string, { locale, slug, preview }: Options) => Promise<AxiosResponse>;
|
|
8
|
+
declare const getStaticPropsFromStrapi: (path: string, { locale, slug, preview, filters }: Options) => Promise<AxiosResponse>;
|
|
8
9
|
export default getStaticPropsFromStrapi;
|
|
@@ -507,20 +507,20 @@ var getStaticPathsFromStrapi = /*#__PURE__*/function () {
|
|
|
507
507
|
|
|
508
508
|
var getStaticPropsFromStrapi = /*#__PURE__*/function () {
|
|
509
509
|
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, _ref) {
|
|
510
|
-
var _ref$locale, locale, slug, _ref$preview, preview, filters, params;
|
|
510
|
+
var _ref$locale, locale, slug, _ref$preview, preview, _ref$filters, filters, enrichedFilters, params;
|
|
511
511
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
512
512
|
while (1) switch (_context.prev = _context.next) {
|
|
513
513
|
case 0:
|
|
514
|
-
_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;
|
|
515
|
-
|
|
514
|
+
_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;
|
|
515
|
+
enrichedFilters = filters;
|
|
516
516
|
if (slug) {
|
|
517
|
-
|
|
517
|
+
enrichedFilters.slug = slug;
|
|
518
518
|
}
|
|
519
519
|
params = {
|
|
520
520
|
populate: 'deep,6',
|
|
521
521
|
locale: locale,
|
|
522
522
|
'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
|
|
523
|
-
filters:
|
|
523
|
+
filters: enrichedFilters
|
|
524
524
|
};
|
|
525
525
|
if (preview) {
|
|
526
526
|
params.publicationState = 'preview';
|