import { useQueries } from "@tanstack/react-query"; import styles from "../../styles"; import { EquipmentsAPI, EquipmentInstancesAPI, UserAPI } from "../API/API"; export default function TechnicianWidgets() { const queries = useQueries({ queries: [ { queryKey: ["equipments"], queryFn: EquipmentsAPI, }, { queryKey: ["equipment_instances"], queryFn: EquipmentInstancesAPI, }, { queryKey: ["user"], queryFn: UserAPI, }, ], }); return (
SKUs in Database
{queries[0].data ? queries[0].data.length : 0}
Items in Database
{queries[1].data ? queries[1].data.length : 0}
Functional Items
{queries[1].data ? queries[1].data.filter( (equipment) => equipment.status == "WORKING" ).length : 0}
Broken Items
{queries[1].data ? queries[1].data.filter( (equipment) => equipment.status == "BROKEN" ).length : 0}