diff --git a/src/services/api.js b/src/services/api.js index a647e04cdb6..0cfd560a7d2 100644 --- a/src/services/api.js +++ b/src/services/api.js @@ -58,6 +58,18 @@ export default { .then((response) => response.json()) }, + getProducts(params = {}) { + const defaultParams = {page: 1, size: 10} // order_by default ? + const url = `${import.meta.env.VITE_OPEN_PRICES_API_URL}/products?${new URLSearchParams({...defaultParams, ...params})}` + return fetch(url, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + }) + .then((response) => response.json()) + }, + getProductById(productId) { const url = `${import.meta.env.VITE_OPEN_PRICES_API_URL}/products/${productId}` return fetch(url, {