feat: persist the queue in the localStorage

This commit is contained in:
Deluan
2020-03-31 14:27:39 -04:00
parent 083a11a563
commit 7fec503b72
6 changed files with 25 additions and 24 deletions
+5 -6
View File
@@ -1,5 +1,5 @@
import 'react-jinke-music-player/assets/index.css'
import { subsonicUrl } from '../subsonic'
import subsonic from '../subsonic'
const PLAYER_ADD_TRACK = 'PLAYER_ADD_TRACK'
const PLAYER_SET_TRACK = 'PLAYER_SET_TRACK'
@@ -11,9 +11,8 @@ const mapToAudioLists = (item) => ({
id: item.id,
name: item.title,
singer: item.artist,
cover: subsonicUrl('getCoverArt', item.id, { size: 300 }),
musicSrc: subsonicUrl('stream', item.id, { ts: true }),
scrobble: (submit) => subsonicUrl('scrobble', item.id, { submission: submit })
cover: subsonic.url('getCoverArt', item.id, { size: 300 }),
musicSrc: subsonic.url('stream', item.id, { ts: true })
})
const addTrack = (data) => ({
@@ -37,7 +36,7 @@ const syncQueue = (data) => ({
data
})
const scrobble = (id) => ({
const scrobbled = (id) => ({
type: PLAYER_SCROBBLE,
data: id
})
@@ -82,4 +81,4 @@ const playQueueReducer = (
}
}
export { addTrack, setTrack, playAlbum, syncQueue, scrobble, playQueueReducer }
export { addTrack, setTrack, playAlbum, syncQueue, scrobbled, playQueueReducer }