Fix crowdsec widget with no bans / alerts

pull/3207/head
shamoon 8 months ago
parent d4c0e482d3
commit 97d193faf1

@ -16,7 +16,7 @@ export default function Component({ service }) {
return <Container service={service} error={alertsError ?? bansError} />;
}
if (!alerts || !bans) {
if (!alerts && !bans) {
return (
<Container service={service}>
<Block label="crowdsec.alerts" />
@ -27,8 +27,8 @@ export default function Component({ service }) {
return (
<Container service={service}>
<Block label="crowdsec.alerts" value={t("common.number", { value: alerts.length })} />
<Block label="crowdsec.bans" value={t("common.number", { value: bans.length })} />
<Block label="crowdsec.alerts" value={t("common.number", { value: alerts?.length ?? 0 })} />
<Block label="crowdsec.bans" value={t("common.number", { value: bans?.length ?? 0 })} />
</Container>
);
}

@ -71,10 +71,6 @@ export default async function crowdsecProxyHandler(req, res) {
logger.debug("Calling Crowdsec API endpoint: %s", endpoint);
if (endpoint.indexOf("decisions") === 0) {
delete params.headers.Authorization;
}
const [status, , data] = await httpProxy(url, params);
if (status !== 200) {

Loading…
Cancel
Save