summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-07-03 14:02:04 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-07-03 14:02:04 +0700
commit7dd4985e667292d79803c5e1de3a11ba42665f4b (patch)
tree478afcc32f3d67c52b678591bc10297258eb6b72 /src/api
parentf7b024585b70f1bd600ba5e0d26368c532ac9723 (diff)
<iman> add feature sequence promotion program
Diffstat (limited to 'src/api')
-rw-r--r--src/api/promoApi.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/api/promoApi.js b/src/api/promoApi.js
index 4c386fba..55067d21 100644
--- a/src/api/promoApi.js
+++ b/src/api/promoApi.js
@@ -15,11 +15,12 @@ export const fetchPromoItems = async (type) => {
export const fetchPromoItemsSolr = async (type) => {
// let query = type ? `type_value_s:${type}` : '*:*';
+ let sort ='sort=if(exists(sequence_i),0,1) asc,sequence_i asc, if(exists(image_s),0,1) asc ';
let start = 0
- let rows = 100
+ let rows = 120
try {
const queryParams = new URLSearchParams({ q: type });
- const response = await fetch(`/solr/promotion_program_lines/select?${queryParams.toString()}&rows=${rows}&start=${start}`);
+ const response = await fetch(`/solr/promotion_program_lines/select?${queryParams.toString()}&rows=${rows}&start=${start}&${sort}`);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
@@ -59,6 +60,7 @@ const map = async (promotions) => {
limit_user: promotion.package_limit_user_i,
limit_trx: promotion.package_limit_trx_i,
price: promotion.price_f,
+ sequence: promotion.sequence_i,
total_qty: promotion.total_qty_i,
products: JSON.parse(promotion.products_s),
product_id: promotion.product_ids[0],