Mergingcurrent_track and current_tracklist; Smarter reducers for UI
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
|
||||
|
||||
var actions = require('./actions.js')
|
||||
|
||||
const SpotifyMiddleware = (function(){
|
||||
|
||||
@ -55,9 +55,6 @@ export default function reducer(spotify = {}, action){
|
||||
case 'SPOTIFY_ME_LOADED':
|
||||
return Object.assign({}, spotify, { me: action.data });
|
||||
|
||||
case 'SPOTIFY_TRACK_LOADED':
|
||||
return Object.assign({}, spotify, { track: action.data });
|
||||
|
||||
case 'SPOTIFY_PLAYLIST_LOADED':
|
||||
return Object.assign({}, spotify, { playlist: action.data });
|
||||
|
||||
@ -71,19 +68,6 @@ export default function reducer(spotify = {}, action){
|
||||
}})
|
||||
return Object.assign({}, spotify, { playlist: playlist });
|
||||
|
||||
case 'SPOTIFY_ALBUM_LOADED':
|
||||
return Object.assign({}, spotify, { album: action.data });
|
||||
|
||||
case 'SPOTIFY_ALBUM_LOADED_MORE':
|
||||
var album = spotify.album
|
||||
Object.assign(album, { tracks: {
|
||||
href: action.data.href,
|
||||
next: action.data.next,
|
||||
previous: action.data.previous,
|
||||
items: [ ...spotify.album.tracks.items, ...action.data.items ]
|
||||
}})
|
||||
return Object.assign({}, spotify, { album: album });
|
||||
|
||||
case 'SPOTIFY_ARTIST_LOADED':
|
||||
return Object.assign({}, spotify, { artist: action.data });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user