UNPKG

test-iki-mini-app

Version:

ứng dựng bán hàng trên mini app z a l o

56 lines (45 loc) 1.56 kB
import { callApi } from "../api/index.jsx"; import { constants as c } from "../constants"; const getAllProduct = () => { return callApi(`/customer/${c.STORE_CODE}/products`, "get"); }; const apiProduct = (product) => { return callApi(`/customer/${c.STORE_CODE}/products/${product.idProduct}`, "GET"); }; const similarProducts = (product) => { return callApi(`/customer/${c.STORE_CODE}/products/${product.idProduct}/similar_products`, "GET"); }; const productByCategory = (category) => { return callApi(`/customer/${c.STORE_CODE}/products?danh-muc=${category.slug}-${category.id}&category_ids=${category.id}&`) } const searchByName = (search) => { return callApi(`/customer/${c.STORE_CODE}/products?search=${search.value}&`) } const productsNew = () => { return callApi(`/customer/${c.STORE_CODE}/home_web/product_news`) } const productsTopSale = (search) => { return callApi(`/customer/${c.STORE_CODE}/home_web/product_top_sales`) } const productFavorite = (product, form) => { callApi(`/customer/${c.STORE_CODE}/products/${product.idProduct}/favorites`, "POST", form) return callApi(`/customer/${c.STORE_CODE}/products/${product.idProduct}`, "GET"); } const favorites = () => { return callApi(`/customer/${c.STORE_CODE}/favorites`) } const getPurchasedProducts = () => { return callApi(`/customer/${c.STORE_CODE}/purchased_products`) } export const product = { getAllProduct, apiProduct, similarProducts, productByCategory, searchByName, productsNew, productsTopSale, productFavorite, favorites, getPurchasedProducts, };