{sector.name}
{sector.description}
{sector.available} de {sector.total} mesas libres-
{sector.tables.map((table) => (
- {table.label} {table.capacity} pax {table.status} ))}
const SectorDemo = () => { const [sectors, setSectors] = React.useState([]); const [loading, setLoading] = React.useState(true); const [error, setError] = React.useState(null); React.useEffect(() => { const controller = new AbortController(); const API_URL = window.SECTOR_API_URL || "http://localhost:4000/api/sectors"; async function fetchSectors() { try { const response = await fetch(API_URL, { signal: controller.signal }); if (!response.ok) { throw new Error("No pudimos cargar los sectores en la demo"); } const payload = await response.json(); setSectors(payload.sectors || []); } catch (err) { if (err.name !== "AbortError") { setError(err.message); } } finally { setLoading(false); } } fetchSectors(); return () => controller.abort(); }, []); if (loading) { return (
Cargando sectores...
{error}
Asegurate de tener el servidor Node ejecutándose.
{sector.description}
{sector.available} de {sector.total} mesas libres