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

@ -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) => {