|
@@ -1,12 +1,12 @@
|
1
|
1
|
const storefrontClient = require('../storefrontClient');
|
2
|
2
|
|
3
|
|
-const customQuery = 'status:active, product_type:snowboard'; // Replace to see custom result
|
|
3
|
+const defaultQuery = 'status:active, product_type:clothing, product_categroy:dresses'; // Replace to see custom result
|
4
|
4
|
|
5
|
|
-const maxResults = 10; // Replace to change the number of result
|
|
5
|
+const defaultResult = 10; // Replace to change the number of result
|
6
|
6
|
|
7
|
|
-const sortBy = 'TITLE'; // Replace with CREATED_AT if need to sort by date, current value is for name
|
|
7
|
+const defaultSortBy = 'TITLE'; // Replace with CREATED_AT if need to sort by date, current value is for name
|
8
|
8
|
|
9
|
|
-const getProduct = async (customQuery) => {
|
|
9
|
+const getProduct = async ( maxResults = defaultResult, sortBy = defaultSortBy, customQuery = defaultQuery ) => {
|
10
|
10
|
try {
|
11
|
11
|
|
12
|
12
|
const query = `{
|
|
@@ -53,4 +53,5 @@ const getProduct = async (customQuery) => {
|
53
|
53
|
}
|
54
|
54
|
};
|
55
|
55
|
|
56
|
|
-getProduct(customQuery);
|
|
56
|
+// Example
|
|
57
|
+// getProduct(5, CREATED_AT, 'product_type:clothing');
|