"use client"; import { useEffect, useState } from "react"; import styles from "./Page.module.css"; type Equipo = { id_equipo: number; nombre_equipo: string; ubicacion: string; activo: { data: number[]; }; plataforma: { nombre: string; }; areaUbicacion: { area: string; }; }; export default function MachineTableActive() { const [machines, setMachines] = useState([]); const [loading, setLoading] = useState(true); const fetchMachines = async () => { try { const res = await fetch( `${process.env.NEXT_PUBLIC_API_URL}/equipo/active`, { cache: "no-store" }, ); const data = await res.json(); setMachines(data); } catch (error) { console.error("Error al cargar equipos", error); } finally { setLoading(false); } }; useEffect(() => { fetchMachines(); }, []); if (loading) { return

Cargando equipos...

; } return (
{machines.map((machine) => { const disponible = machine.activo.data[0] === 1; return ( ); })}
Ubicación Nombre Equipo Plataforma Área Disponible
{machine.ubicacion} {machine.nombre_equipo} {machine.plataforma.nombre} {machine.areaUbicacion.area} {disponible ? "Sí" : "No"}
); }