Editing playlist modal
This commit is contained in:
@ -503,16 +503,32 @@ export function getSearchResults( query, type = 'album,artist,playlist,track', l
|
||||
* Playlists
|
||||
**/
|
||||
|
||||
export function createPlaylist( name, is_private ){
|
||||
export function createPlaylist( name, is_public ){
|
||||
return (dispatch, getState) => {
|
||||
|
||||
sendRequest( dispatch, getState, 'users/'+ getState().spotify.me.id +'/playlists/', 'POST', { name: name, public: !is_private } )
|
||||
sendRequest( dispatch, getState, 'users/'+ getState().spotify.me.id +'/playlists/', 'POST', { name: name, public: is_public } )
|
||||
.then( response => {
|
||||
dispatch( getAllLibraryPlaylists() );
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export function savePlaylist( uri, name, is_public ){
|
||||
return (dispatch, getState) => {
|
||||
|
||||
sendRequest( dispatch, getState, 'users/'+ getState().spotify.me.id +'/playlists/'+ helpers.getFromUri('playlistid',uri), 'PUT', { name: name, public: is_public } )
|
||||
.then( response => {
|
||||
dispatch({
|
||||
type: 'PLAYLIST_UPDATED',
|
||||
playlist: {
|
||||
name: name,
|
||||
public: is_public
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export function getPlaylist( uri ){
|
||||
return (dispatch, getState) => {
|
||||
|
||||
|
||||
@ -51,6 +51,16 @@ const SpotifyMiddleware = (function(){
|
||||
store.dispatch( actions.addTracksToPlaylist( action.playlist_uri, action.tracks_uris ))
|
||||
break
|
||||
|
||||
|
||||
case 'SPOTIFY_SAVE_PLAYLIST':
|
||||
|
||||
if( !store.getState().spotify.authorized ){
|
||||
alert('Must be logged in to Spotify to do this')
|
||||
return
|
||||
}
|
||||
store.dispatch( actions.savePlaylist( action.uri, action.name, action.is_public ))
|
||||
break
|
||||
|
||||
// when our mopidy server current track changes
|
||||
case 'MOPIDY_CURRENTTLTRACK':
|
||||
|
||||
|
||||
Reference in New Issue
Block a user