diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-05-27 10:32:45 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-05-27 10:32:45 +0700 |
| commit | 62d2edfa5ae62cd8faa2d0322ddfd5dfa6ad2d2e (patch) | |
| tree | d6cceab24bd7f7c4dbfc4c0ff3ef3c932e0d9b14 /src/api/productApi.js | |
| parent | 6499f025995f13fcf32b2b5f79c8ee14585668fc (diff) | |
| parent | fd867a90e22fb2fc2fb16237165796ebe0cabab0 (diff) | |
<hafid> merge repeat order & new-release
Diffstat (limited to 'src/api/productApi.js')
| -rw-r--r-- | src/api/productApi.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/api/productApi.js b/src/api/productApi.js index 4a29b59d..dc96a77e 100644 --- a/src/api/productApi.js +++ b/src/api/productApi.js @@ -1,13 +1,15 @@ -import axios from 'axios' +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 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=${page}&orderBy=stock&priceFrom=1` - ) - return dataPopularProducts.data.response - } -} + ); + return dataPopularProducts.data.response; + }; +}; |
