Use Swell REST API for fetching products
This commit is contained in:
@@ -65,35 +65,4 @@ export const removeCartItem = async (productId: string) => {
|
||||
if (updatedCart) {
|
||||
return updatedCart
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Fetch products
|
||||
*/
|
||||
export const getProducts = async (category?: string, limit: number = 25, page: number = 1) => {
|
||||
const products = await swell.products.list({
|
||||
where: {
|
||||
active: true,
|
||||
},
|
||||
category,
|
||||
limit,
|
||||
page
|
||||
})
|
||||
|
||||
if (products) {
|
||||
return products
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a product
|
||||
*/
|
||||
export const getProduct = async (id: string) => {
|
||||
const product = await swell.products.get(id)
|
||||
|
||||
if (product) {
|
||||
return product
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user