diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-08-01 17:07:20 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-08-01 17:07:20 +0700 |
| commit | 942b4c3548891f25198140b80192e9190a403ee5 (patch) | |
| tree | f1f4d7ca6d7ff998179cb72e1814b7f65d9b56fe /src/api | |
| parent | e1c6052ffc9887e792f19f99d900189647845c69 (diff) | |
flash sale
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/productApi.js | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/src/api/productApi.js b/src/api/productApi.js index 6d043172..feb91257 100644 --- a/src/api/productApi.js +++ b/src/api/productApi.js @@ -1,26 +1,10 @@ -import odooApi from '@/core/api/odooApi' -import productSearchApi from '@/lib/product/api/productSearchApi' import axios from 'axios' -import { useState } from 'react' export const popularProductApi = () => { - let dataFlashSale = null return async () => { - const flashSale = await odooApi('GET', '/api/v1/flashsale/header') - if(flashSale){ - const dataProducts = await productSearchApi({ - query: `fq=flashsale_id_i:${flashSale[0].pricelistId}&fq=flashsale_price_f:[1 TO *]&limit=2`, - operation: 'AND' - }) - dataFlashSale = dataProducts.response.products - } const dataPopularProducts = await axios( `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/search?q=*&page=1&orderBy=popular-weekly` ) - dataPopularProducts.data.response.products = [ - ...dataFlashSale, - ...dataPopularProducts.data.response.products, - ]; return dataPopularProducts.data.response } } |
