chore: Create Catalog Page

This commit is contained in:
2026-01-21 18:36:02 -05:00
parent 8814d4b10a
commit af198a6ea8
6 changed files with 37 additions and 23 deletions

View File

@@ -0,0 +1,30 @@
import { ProductCards } from "./components";
import { useEffect, useState } from "react";
import type { Product } from "../../types";
const Catalog = () => {
const [products, setProducts] = useState<Product[]>([]);
useEffect(() => {
async function fetchProducts(){
try{
const response = await fetch("http://localhost:8010/api/v1/products");
const data = await response.json();
setProducts(data);
}catch(error){
console.error(`Este es el error: ${error}`);
};
};
fetchProducts();
}, []);
return (
<>
<ProductCards products={products}/>
</>
)
}
export default Catalog;