Function
Fetches all products from the API.
This function sends a GET request to the API to retrieve all products. If the request is successful, it returns the product data. In case of an error, it catches the error and logs it, returning an empty array.
getProducts
The response data from the API, which contains an array of products, or an empty array if an error occurs.
If there is an error during the request, it is caught and logged.
Fetches all products from the API.
This function sends a GET request to the API to retrieve all products. If the request is successful, it returns the product data. In case of an error, it catches the error and logs it, returning an empty array.
getProducts