refactor vuex actions
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<template #button-content>
|
||||
<Icon icon="three-dots-vertical" />
|
||||
</template>
|
||||
<b-dropdown-item-button @click="playNext()">
|
||||
<b-dropdown-item-button @click="setNextInQueue()">
|
||||
Play next
|
||||
</b-dropdown-item-button>
|
||||
<b-dropdown-item-button @click="addToQueue()">
|
||||
@@ -36,8 +36,8 @@
|
||||
}
|
||||
this.starred = !this.starred
|
||||
},
|
||||
playNext() {
|
||||
return this.$store.dispatch('player/playNext', this.track)
|
||||
setNextInQueue() {
|
||||
return this.$store.dispatch('player/setNextInQueue', this.track)
|
||||
},
|
||||
addToQueue() {
|
||||
return this.$store.dispatch('player/addToQueue', this.track)
|
||||
|
||||
@@ -120,9 +120,9 @@
|
||||
if ((this.tracks as any)[index].id === this.playingTrackId) {
|
||||
return this.$store.dispatch('player/playPause')
|
||||
}
|
||||
return this.$store.dispatch('player/playQueue', {
|
||||
return this.$store.dispatch('player/playTrackList', {
|
||||
index,
|
||||
queue: this.tracks,
|
||||
tracks: this.tracks,
|
||||
})
|
||||
},
|
||||
dragstart(id: string, event: any) {
|
||||
|
||||
@@ -60,9 +60,9 @@
|
||||
methods: {
|
||||
play() {
|
||||
if (this.album?.tracks) {
|
||||
return this.$store.dispatch('player/playQueue', {
|
||||
return this.$store.dispatch('player/playTrackList', {
|
||||
index: 0,
|
||||
queue: this.album.tracks,
|
||||
tracks: this.album.tracks,
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -59,7 +59,10 @@
|
||||
if (this.items[index].id === this.playingTrackId) {
|
||||
return this.$store.dispatch('player/playPause')
|
||||
}
|
||||
return this.$store.dispatch('player/playQueue', { index, queue: this.items })
|
||||
return this.$store.dispatch('player/playTrackList', {
|
||||
index,
|
||||
tracks: this.items
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user