Adding as an index reference where index uris change

This commit is contained in:
James Barnsley
2019-02-01 10:19:21 +13:00
parent 1406985662
commit 9afbaa5b03
8 changed files with 131 additions and 72 deletions

View File

@ -152,6 +152,31 @@ export default function reducer(core = {}, action){
/**
* Remove an item from an index
**/
case 'REMOVE_FROM_INDEX':
var index = Object.assign({}, core[action.index_name]);
// We have a new key to redirect to
if (action.new_key){
index[action.key] = {
moved_to: action.new_key
}
// No redirection, so just a clean delete
} else {
delete index[action.key];
}
var updated_core = {};
updated_core[action.index_name] = index;
return Object.assign({}, core, updated_core);
/**
* Playlists