From cd3ee0728c032b0515cd0e0ce1b96dfb25f5f41a Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Fri, 19 Aug 2022 11:07:45 +0000 Subject: [PATCH] Handle the case where only one plugin is installed fixes #329 --- public/js/subscription-manager.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/js/subscription-manager.js b/public/js/subscription-manager.js index fad4e56c..3d76d305 100644 --- a/public/js/subscription-manager.js +++ b/public/js/subscription-manager.js @@ -13,12 +13,12 @@ const component = () => { if (!data.success) throw new Error(data.error); this.plugins = data.plugins; - const pid = localStorage.getItem("plugin"); - if (pid && this.plugins.map((p) => p.id).includes(pid)) - this.pid = pid; - else if (this.plugins.length > 0) - this.pid = this.plugins[0].id; + let pid = localStorage.getItem("plugin"); + if (!pid || !this.plugins.find((p) => p.id === pid)) { + pid = this.plugins[0].id; + } + this.pid = pid; this.list(pid); }) .catch((e) => {