Implement adding individual tracks to Spotify library via context menu.

This commit is contained in:
Keith Scheiwiller
2018-10-08 17:02:44 -05:00
parent d8f314b6ae
commit 1045b70259
2 changed files with 23 additions and 1 deletions

View File

@ -307,6 +307,16 @@ export default function reducer(spotify = {}, action){
}
return Object.assign({}, spotify, { library_playlists: items });
case 'SPOTIFY_LIBRARY_TRACK_CHECK':
var items = Object.assign([], spotify.library_tracks)
var index = items.indexOf(action.key)
if (index > -1 && !action.in_library) {
items.splice(index, 1)
} else if (index < 0 && action.in_library){
items.push(action.key)
}
return Object.assign({}, spotify, { library_tracks: items });
/**
* Searching