diff options
| author | Kit La Touche <kit@transneptune.net> | 2024-10-31 16:24:31 -0400 |
|---|---|---|
| committer | Kit La Touche <kit@transneptune.net> | 2024-10-31 16:24:31 -0400 |
| commit | 213266f97a9c72c66b75742931b15fd195aa7959 (patch) | |
| tree | 9dbefea290fe8d4ecda21b460730b97072db713a /ui/lib/store | |
| parent | 6d523b4247f750e2bbd8e16fb3ce206323982e8e (diff) | |
Do some toast notificating
Diffstat (limited to 'ui/lib/store')
| -rw-r--r-- | ui/lib/store/channels.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ui/lib/store/channels.js b/ui/lib/store/channels.js index b57ca7e..6d722c5 100644 --- a/ui/lib/store/channels.js +++ b/ui/lib/store/channels.js @@ -1,17 +1,26 @@ export class Channels { constructor() { this.channels = []; + this.channelData = {}; } setChannels(channels) { this.channels = [...channels]; this.sort(); + this.channelData = channels.reduce( + (acc, val) => ({ + ...acc, + [val.id]: val.name, + }), + {} + ); return this; } addChannel(id, name) { this.channels = [...this.channels, { id, name }]; this.sort(); + this.channelData[id] = name; return this; } @@ -20,9 +29,14 @@ export class Channels { if (channelIndex !== -1) { this.channels.splice(channelIndex, 1); } + delete this.channelData[id]; return this; } + get(id) { + return this.channelData[id]; + } + sort() { this.channels.sort((a, b) => { if (a.name < b.name) { |
