Categories moved to spotify, formatted images
This commit is contained in:
@ -602,8 +602,8 @@ const CoreMiddleware = (function(){
|
||||
var artists_index = Object.assign({}, core.artists);
|
||||
var artists_loaded = [];
|
||||
var tracks_loaded = [];
|
||||
|
||||
action.artists.forEach(raw_artist => {
|
||||
|
||||
for (var raw_artist of action.artists){
|
||||
var artist = helpers.formatArtist(raw_artist);
|
||||
|
||||
// Already have an artist in the index
|
||||
@ -628,7 +628,7 @@ const CoreMiddleware = (function(){
|
||||
}
|
||||
|
||||
artists_loaded.push(artist);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
action.artists = artists_loaded;
|
||||
@ -736,10 +736,6 @@ const CoreMiddleware = (function(){
|
||||
var records = action.records_data;
|
||||
}
|
||||
|
||||
if (action.records_type == 'track'){
|
||||
records = helpers.formatTracks(records);
|
||||
}
|
||||
|
||||
var records_type_plural = action.records_type+'s';
|
||||
var records_index = Object.assign({});
|
||||
var records_uris = helpers.arrayOf('uri', records);
|
||||
|
||||
@ -65,55 +65,6 @@ export default function reducer(core = {}, action){
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Categories
|
||||
**/
|
||||
|
||||
case 'CATEGORY_LOADED':
|
||||
var categories = Object.assign([], core.categories)
|
||||
|
||||
if (categories[action.key]){
|
||||
var category = Object.assign({}, categories[action.key], action.category)
|
||||
} else {
|
||||
var category = Object.assign({}, action.category)
|
||||
}
|
||||
|
||||
categories[action.key] = category
|
||||
return Object.assign({}, core, { categories: categories });
|
||||
|
||||
case 'CATEGORIES_LOADED':
|
||||
var categories = Object.assign([], core.categories)
|
||||
|
||||
for (var i = 0; i < action.categories.length; i++){
|
||||
var key = 'category:'+action.categories[i].id
|
||||
if (categories[key]){
|
||||
var category = Object.assign({}, categories[key], action.categories[i])
|
||||
} else {
|
||||
var category = Object.assign({}, action.categories[i])
|
||||
}
|
||||
categories[key] = category
|
||||
}
|
||||
|
||||
return Object.assign({}, core, { categories: categories });
|
||||
|
||||
case 'CATEGORY_PLAYLISTS_LOADED':
|
||||
var categories = Object.assign([], core.categories)
|
||||
var playlists_uris = []
|
||||
if (categories[action.key].playlists_uris) playlists_uris = categories[action.key].playlists_uris
|
||||
|
||||
var category = Object.assign(
|
||||
{},
|
||||
categories[action.key],
|
||||
{
|
||||
playlists_uris: [...playlists_uris, ...action.uris],
|
||||
playlists_more: action.more,
|
||||
playlists_total: action.total
|
||||
}
|
||||
)
|
||||
categories[action.key] = category
|
||||
return Object.assign({}, core, { categories: categories });
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user