Skip to content

Commit

Permalink
Handle the case where only one plugin is installed
Browse files Browse the repository at this point in the history
fixes #329
  • Loading branch information
hkalexling committed Aug 19, 2022
1 parent e4af194 commit cd3ee07
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions public/js/subscription-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit cd3ee07

Please sign in to comment.