From baf0a1bdb9617f3c80de68893f8c07835ce21107 Mon Sep 17 00:00:00 2001 From: Suven-p Date: Mon, 28 Oct 2024 06:05:35 +0545 Subject: [PATCH] Refactor --- src/components/MonitorList.vue | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/components/MonitorList.vue b/src/components/MonitorList.vue index 6951bbba..272421e0 100644 --- a/src/components/MonitorList.vue +++ b/src/components/MonitorList.vue @@ -165,27 +165,21 @@ export default { filterState() { // Since query params are always strings, convert them to the correct type let status = this.$route.query["status"] || []; - if (status) { - if (!Array.isArray(status)) { - status = [ status ]; - } - status = status.map(Number); + if (!Array.isArray(status)) { + status = [ status ]; } + status = status.map(Number); // Casting to boolean does not work here as Boolean("false") === true let active = this.$route.query["active"] || []; - if (active) { - if (!Array.isArray(active)) { - active = [ active ]; - } - active = active.map(val => val === "true"); + if (!Array.isArray(active)) { + active = [ active ]; } + active = active.map(val => val === "true"); let tags = this.$route.query["tags"] || []; - if (tags) { - if (!Array.isArray(tags)) { - tags = [ tags ]; - } - tags = tags.map(Number); + if (!Array.isArray(tags)) { + tags = [ tags ]; } + tags = tags.map(Number); return { status, active,