diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-09-20 16:52:16 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-09-20 16:52:16 +0700 |
| commit | a784f4623448ff846dbc5c8259405e6cce8fffb7 (patch) | |
| tree | 016da331ea5a18ef2c3c1264728b1199b5e9172a /src/api/productApi.js | |
| parent | 1db54e16f970b4e09df89d432efd5a66ac775eb6 (diff) | |
| parent | b7e7696d675d0c2e36364f7cbedb0483a343048d (diff) | |
Merge branch 'release' into Feature/new-register
Diffstat (limited to 'src/api/productApi.js')
| -rw-r--r-- | src/api/productApi.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/api/productApi.js b/src/api/productApi.js index 009d95ef..4a29b59d 100644 --- a/src/api/productApi.js +++ b/src/api/productApi.js @@ -2,8 +2,11 @@ import axios from 'axios' export const popularProductApi = () => { return async () => { + const today = new Date(); + const dayOfYear = Math.floor((today - new Date(today.getFullYear(), 0, 0)) / 86400000); + const page = (dayOfYear % 24) + 1; const dataPopularProducts = await axios( - `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/search?q=*&page=1&orderBy=popular-weekly&priceFrom=1` + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/search?q=*&page=${page}&orderBy=stock&priceFrom=1` ) return dataPopularProducts.data.response } |
