Change addTrack action to addTracks, supporting multiple tracks to be added to the queue in one call

This commit is contained in:
Deluan
2020-05-05 12:07:50 -04:00
parent 5495451448
commit 23836d7c3c
4 changed files with 23 additions and 15 deletions
+8 -6
View File
@@ -16,13 +16,13 @@ const mapToAudioLists = (item) => ({
musicSrc: subsonic.url('stream', item.id, { ts: true }),
})
const addTrack = (data) => ({
type: PLAYER_ADD_TRACK,
const setTrack = (data) => ({
type: PLAYER_SET_TRACK,
data,
})
const setTrack = (data) => ({
type: PLAYER_SET_TRACK,
const addTracks = (data) => ({
type: PLAYER_ADD_TRACK,
data,
})
@@ -74,7 +74,9 @@ const playQueueReducer = (
switch (type) {
case PLAYER_ADD_TRACK:
queue = previousState.queue
queue.push(mapToAudioLists(data))
data.forEach((item) => {
queue.push(mapToAudioLists(item))
})
return { ...previousState, queue, clear: false }
case PLAYER_SET_TRACK:
return {
@@ -131,7 +133,7 @@ const playQueueReducer = (
}
export {
addTrack,
addTracks,
setTrack,
playAlbum,
syncQueue,