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.
- package/dist/node_modules/base64-js/index.js +1 -1
- package/dist/node_modules/ieee754/index.js +1 -1
- package/dist/src/data/loaders/e-commerce/getPaginatedCategories.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/data/loaders/e-commerce/getPaginatedCategories.d.ts +1 -5
- package/package.json +1 -1
- package/src/data/loaders/e-commerce/getPaginatedCategories.ts +8 -6
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export declare function getPaginatedCategories(currentPage?: number,
|
|
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
|
@@ -7,10 +7,10 @@ import { getStrapiURL } from "../../../lib/utils";
|
|
|
7
7
|
const baseUrl = getStrapiURL();
|
|
8
8
|
|
|
9
9
|
export async function getPaginatedCategories(
|
|
10
|
-
currentPage
|
|
11
|
-
rowsPerPage
|
|
12
|
-
order
|
|
13
|
-
orderBy
|
|
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:
|
|
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
|
|
44
|
+
page: currentPage ? currentPage : 1, // because table pagination starts at 0 but strapi starts at 1
|
|
43
45
|
},
|
|
44
46
|
});
|
|
45
47
|
|