Lazy loading keys; Spotify new releases in Spotify reducer, handling duplicates bug
This commit is contained in:
@ -68,17 +68,17 @@ export default function reducer(spotify = {}, action){
|
||||
case 'SPOTIFY_FEATURED_PLAYLISTS_LOADED':
|
||||
return Object.assign({}, spotify, { featured_playlists: action.data })
|
||||
|
||||
case 'SPOTIFY_NEW_RELEASES_LOADED':
|
||||
return Object.assign({}, spotify, { new_releases: action.data });
|
||||
|
||||
case 'SPOTIFY_NEW_RELEASES_LOADED_MORE':
|
||||
console.log([ ...spotify.new_releases.items, ...action.data.albums.items]);
|
||||
return Object.assign({}, spotify, { new_releases: {
|
||||
href: action.data.albums.href,
|
||||
next: action.data.albums.next,
|
||||
previous: action.data.albums.previous,
|
||||
items: [ ...spotify.new_releases.items, ...action.data.albums.items]
|
||||
}});
|
||||
case 'SPOTIFY_NEW_RELEASES_LOADED':
|
||||
var new_releases = [];
|
||||
if (spotify.new_releases){
|
||||
new_releases = Object.assign([], spotify.new_releases);
|
||||
}
|
||||
return Object.assign({}, spotify, {
|
||||
new_releases: helpers.removeDuplicates([...new_releases, ...action.uris]),
|
||||
new_releases_more: action.more,
|
||||
new_releases_total: action.total
|
||||
});
|
||||
|
||||
case 'SPOTIFY_DISCOVER_LOADED':
|
||||
if (!action.data ){
|
||||
|
||||
Reference in New Issue
Block a user