From 616e8f2553256cb81af1b007f7765ab6f954dc58 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 3 Apr 2023 14:23:12 -0700 Subject: [PATCH] diskstation codestyle --- src/widgets/diskstation/component.jsx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/widgets/diskstation/component.jsx b/src/widgets/diskstation/component.jsx index 062b33f1..afc41ae4 100644 --- a/src/widgets/diskstation/component.jsx +++ b/src/widgets/diskstation/component.jsx @@ -33,16 +33,7 @@ export default function Component({ service }) { const uptime = `${ t("common.number", { value: days }) } ${ t("diskstation.days") }`; // storage info - const volumeName = widget.volume; - - let volume; - - if (volumeName) { - volume = storageData.data.vol_info?.find(vol => vol.name === volumeName) - } else { - volume = storageData.data.vol_info?.[0]; - } - + const volume = widget.volume ? storageData.data.vol_info?.find(vol => vol.name === widget.volume) : storageData.data.vol_info?.[0]; const usedBytes = parseFloat(volume?.used_size); const totalBytes = parseFloat(volume?.total_size); const freeBytes = totalBytes - usedBytes;