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.

featuredProductsRequest.ts 502B

1234567891011121314151617
  1. import { FeaturedProductsResponse } from '../../utils/interface/productInterface';
  2. import apiEndpoints from '../apiEndpoints';
  3. export const getFeaturedProducts =
  4. async (): Promise<FeaturedProductsResponse> => {
  5. const response = await fetch(
  6. `http://localhost:3000${apiEndpoints.featuredProducts}`
  7. );
  8. const data: FeaturedProductsResponse = await response.json();
  9. if (!response.ok) {
  10. throw new Error(data.message || 'Something went wrong!');
  11. }
  12. return data;
  13. };