umwd-components 0.1.691 → 0.1.693

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.
@@ -1,5 +1 @@
1
- export declare function getPaginatedCategories(currentPage?: number, // default to page 0
2
- rowsPerPage?: number, // default to 4 rows per page
3
- order?: "asc" | "desc", // default to descending order
4
- orderBy?: string, // default to ordering by id
5
- is_archive?: boolean[]): Promise<any>;
1
+ export declare function getPaginatedCategories(currentPage?: number, rowsPerPage?: number, order?: "asc" | "desc", orderBy?: string, is_archive?: boolean[]): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.691",
3
+ "version": "0.1.693",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/src/index.js",
@@ -7,10 +7,10 @@ import { getStrapiURL } from "../../../lib/utils";
7
7
  const baseUrl = getStrapiURL();
8
8
 
9
9
  export async function getPaginatedCategories(
10
- currentPage: number = 0, // default to page 0
11
- rowsPerPage: number = 4, // default to 4 rows per page
12
- order: "asc" | "desc" = "desc", // default to descending order
13
- orderBy: string = "id", // default to ordering by id
10
+ currentPage?: number,
11
+ rowsPerPage?: number,
12
+ order?: "asc" | "desc",
13
+ orderBy?: string,
14
14
  is_archive: boolean[] = [false] // default to both archived and non-archived categories
15
15
  ) {
16
16
  const url = new URL(`/api/product-categories`, baseUrl);
@@ -26,7 +26,9 @@ export async function getPaginatedCategories(
26
26
 
27
27
  url.search = qs.stringify({
28
28
  filters: {
29
- is_archive: false, // always filter out archived categories
29
+ is_archive: {
30
+ $in: is_archive,
31
+ },
30
32
  },
31
33
  populate: {
32
34
  products: {
@@ -39,7 +41,7 @@ export async function getPaginatedCategories(
39
41
  sort: `${orderBy || "id"}:${order || "desc"}`,
40
42
  pagination: {
41
43
  pageSize: rowsPerPage || 4,
42
- page: currentPage ? currentPage + 1 : 1, // because table pagination starts at 0 but strapi starts at 1
44
+ page: currentPage ? currentPage : 1, // because table pagination starts at 0 but strapi starts at 1
43
45
  },
44
46
  });
45
47