You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

productRequest.js 331B

1234567891011121314151617
  1. export const getAllProducts = async ({
  2. url,
  3. category = 'All',
  4. filter = 'asc',
  5. }) => {
  6. const response = await fetch(
  7. `${url}&category=${category}&filterType=${filter}`
  8. );
  9. const data = await response.json();
  10. if (!response.ok) {
  11. throw new Error(data.message || 'Something went wrong!');
  12. }
  13. return data;
  14. };