Now use vuex to manage state for player/queue/radios

This commit is contained in:
Eliot Berriot 2017-12-23 16:41:19 +01:00
parent 254996453f
commit df94ae37bf
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
16 changed files with 563 additions and 694 deletions

View file

@ -17,7 +17,6 @@
<script>
import logger from '@/logging'
import queue from '@/audio/queue'
import jQuery from 'jquery'
export default {
@ -40,19 +39,19 @@ export default {
methods: {
add () {
if (this.track) {
queue.append(this.track)
this.$store.dispatch('queue/append', {track: this.track})
} else {
queue.appendMany(this.tracks)
this.$store.dispatch('queue/appendMany', {tracks: this.tracks})
}
},
addNext (next) {
if (this.track) {
queue.append(this.track, queue.currentIndex + 1)
this.$store.dispatch('queue/append', {track: this.track, index: this.$store.state.queue.currentIndex + 1})
} else {
queue.appendMany(this.tracks, queue.currentIndex + 1)
this.$store.dispatch('queue/appendMany', {tracks: this.tracks, index: this.$store.state.queue.currentIndex + 1})
}
if (next) {
queue.next()
this.$store.dispatch('queue/next')
}
}
}