Editing playlist modal

This commit is contained in:
James Barnsley
2016-11-14 17:32:36 +13:00
parent cc99c8bf37
commit df30327fe3
18 changed files with 423 additions and 231 deletions

View File

@ -280,7 +280,11 @@ const MopidyMiddleware = (function(){
}
var playlist = Object.assign({}, response)
playlist.tracks = [...playlist.tracks, ...tracks]
if( playlist.tracks ){
playlist.tracks = [...playlist.tracks, ...tracks]
}else{
playlist.tracks = tracks
}
instruct( socket, store, 'playlists.save', { playlist: playlist } )
.then( response => {
@ -320,6 +324,21 @@ const MopidyMiddleware = (function(){
});
break
case 'MOPIDY_SAVE_PLAYLIST':
instruct( socket, store, 'playlists.lookup', { uri: action.uri })
.then( response => {
var playlist = Object.assign({}, response, { name: action.name })
instruct( socket, store, 'playlists.save', { playlist: playlist } )
.then( response => {
// TODO: changing the name changes the URI, so essentially invalidates our url...
// need to figure out how to handle this
store.dispatch({ type: 'PLAYLIST_UPDATED', playlist: playlist });
})
});
break
case 'MOPIDY_DELETE_PLAYLIST':
instruct( socket, store, 'playlists.delete', { uri: action.uri })
.then( response => {