add 'add to queue'

This commit is contained in:
Thomas Amland 2020-08-07 10:21:11 +02:00
parent b949db6efd
commit d89bbfe5f7
2 changed files with 12 additions and 0 deletions

View File

@ -6,6 +6,9 @@
<b-dropdown-item-button @click="playNext()"> <b-dropdown-item-button @click="playNext()">
Play next Play next
</b-dropdown-item-button> </b-dropdown-item-button>
<b-dropdown-item-button @click="addToQueue()">
Add to queue
</b-dropdown-item-button>
<b-dropdown-item-button @click="toggleStarred()"> <b-dropdown-item-button @click="toggleStarred()">
{{ starred ? 'Unstar' : 'Star' }} {{ starred ? 'Unstar' : 'Star' }}
</b-dropdown-item-button> </b-dropdown-item-button>
@ -36,6 +39,9 @@
playNext() { playNext() {
return this.$store.dispatch("player/playNext", this.track); return this.$store.dispatch("player/playNext", this.track);
}, },
addToQueue() {
return this.$store.dispatch("player/addToQueue", this.track);
},
} }
}); });
</script> </script>

View File

@ -66,6 +66,9 @@ export const playerModule: Module<State, any> = {
}); });
} }
}, },
addToQueue(state, track) {
state.queue.push(track);
},
removeFromQueue(state, index) { removeFromQueue(state, index) {
state.queue.splice(index, 1); state.queue.splice(index, 1);
if (index < state.queueIndex) { if (index < state.queueIndex) {
@ -120,6 +123,9 @@ export const playerModule: Module<State, any> = {
playNext({ commit }, track) { playNext({ commit }, track) {
commit("setNextInQueue", track); commit("setNextInQueue", track);
}, },
addToQueue({ commit }, track) {
commit("addToQueue", track);
},
}, },
getters: { getters: {