mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
fix: page reload setting current track to first track in queue
- add a `setCurrent` method to update current index and currentid
This commit is contained in:
@@ -137,6 +137,7 @@ export default defineStore("Queue", {
|
||||
this.updateCurrent(readCurrent());
|
||||
},
|
||||
updateCurrent(index: number) {
|
||||
this.setCurrent(index);
|
||||
this.updateNext(index);
|
||||
this.updatePrev(index);
|
||||
|
||||
@@ -158,6 +159,10 @@ export default defineStore("Queue", {
|
||||
|
||||
this.prev = index - 1;
|
||||
},
|
||||
setCurrent(index: number) {
|
||||
this.current = index;
|
||||
this.currentid = this.tracks[index].trackid;
|
||||
},
|
||||
setNewQueue(tracklist: Track[]) {
|
||||
if (this.tracks !== tracklist) {
|
||||
this.tracks = [];
|
||||
|
||||
Reference in New Issue
Block a user