diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-05-22 15:27:01 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-05-22 15:27:01 +0700 |
| commit | 1e89e64ec0bccbe89b9cede0b2054547d40589fa (patch) | |
| tree | 7910f4fa4b8526ac23cff814aa0f3983aebb874d /src/api | |
| parent | 33da0fcb718335eb1d077af4321ac65e0146a2d6 (diff) | |
Refactor hero banner and popular product section
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/bannerApi.js (renamed from src/api/BannerApi.js) | 2 | ||||
| -rw-r--r-- | src/api/productApi.js | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/api/BannerApi.js b/src/api/bannerApi.js index 8ebecd26..8bae131d 100644 --- a/src/api/BannerApi.js +++ b/src/api/bannerApi.js @@ -1,5 +1,5 @@ import odooApi from '@/core/api/odooApi' -export const BannerApi = ({ type }) => { +export const bannerApi = ({ type }) => { return async () => await odooApi('GET', `/api/v1/banner?type=${type}`) } diff --git a/src/api/productApi.js b/src/api/productApi.js new file mode 100644 index 00000000..cca052f7 --- /dev/null +++ b/src/api/productApi.js @@ -0,0 +1,10 @@ +import axios from 'axios' + +export const popularProductApi = () => { + return async () => { + const dataPopularProducts = await axios( + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/search?q=*&page=1&orderBy=popular` + ) + return dataPopularProducts.data.response + } +} |
