Get a category of products from Swell
This commit is contained in:
@@ -5,6 +5,25 @@ swell.init(import.meta.env.VITE_SWELL_STORE_ID, import.meta.env.VITE_SWELL_API_T
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Fetch products
|
||||
*/
|
||||
export const getProducts = async (category?: string, limit: number = 25, page: number = 1) => {
|
||||
const products = await swell.get('/products', {
|
||||
where: {
|
||||
active: true,
|
||||
},
|
||||
category,
|
||||
limit,
|
||||
page
|
||||
})
|
||||
|
||||
if (products) {
|
||||
return products
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve a product
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user