fix: net transfer display error

This commit is contained in:
hamster1963 2024-12-01 09:44:13 +08:00
parent 7e259f22de
commit f46dd8e479

View File

@ -66,12 +66,18 @@ export default function Servers() {
)?.length || 0; )?.length || 0;
const up = const up =
nezhaWsData?.servers?.reduce( nezhaWsData?.servers?.reduce(
(total, server) => total + server.state.net_out_transfer, (total, server) =>
formatNezhaInfo(nezhaWsData.now, server).online
? total + (server.state?.net_out_transfer ?? 0)
: total,
0, 0,
) || 0; ) || 0;
const down = const down =
nezhaWsData?.servers?.reduce( nezhaWsData?.servers?.reduce(
(total, server) => total + server.state.net_in_transfer, (total, server) =>
formatNezhaInfo(nezhaWsData.now, server).online
? total + (server.state?.net_in_transfer ?? 0)
: total,
0, 0,
) || 0; ) || 0;