import useSWR from "swr"; import { useTranslation } from "react-i18next"; import Widget from "../widget"; import Block from "../block"; import { formatApiUrl } from "utils/api-helpers"; export default function Npm({ service }) { const { t } = useTranslation(); const config = service.widget; const { data: infoData, error: infoError } = useSWR(formatApiUrl(config, "nginx/proxy-hosts")); if (infoError) { return ; } if (!infoData) { return ( ); } const enabled = infoData.filter((c) => c.enabled === 1).length; const disabled = infoData.filter((c) => c.enabled === 0).length; const total = infoData.length; return ( ); }