diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2024-01-18 12:08:37 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2024-01-18 12:08:37 +0700 |
| commit | f02511b103acce8d3fa4bc174a43be15c4cca052 (patch) | |
| tree | 08b01776038a9c44f0e21b85c3f776b22c342081 /src-migrate/services | |
| parent | f7a0be1407da7edab60f6cb2ca3f1ef97acf811a (diff) | |
Update add to wishlist in product detail
Diffstat (limited to 'src-migrate/services')
| -rw-r--r-- | src-migrate/services/wishlist.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src-migrate/services/wishlist.ts b/src-migrate/services/wishlist.ts new file mode 100644 index 00000000..6fb8cb2e --- /dev/null +++ b/src-migrate/services/wishlist.ts @@ -0,0 +1,23 @@ +import odooApi from '~/libs/odooApi'; + +export const getUserWishlist = async ( + userId: number, + searchParams: { + product_id?: string; + } = {} +): Promise<{ product_total: number }> => { + const url = `/api/v1/user/${userId}/wishlist`; + const searchParamsObj = new URLSearchParams(searchParams); + + return await odooApi('GET', url + '?' + searchParamsObj.toString()); +}; + +export const upsertUserWishlist = async ( + userId: number, + productId: number +): Promise<{ id: number }> => { + const url = `/api/v1/user/${userId}/wishlist/create-or-delete`; + const data = { product_id: productId }; + + return await odooApi('POST', url, data); +}; |
