Removing/unfollowing playlists
This commit is contained in:
@ -160,6 +160,14 @@ export function getImages( context, uris ){
|
||||
}
|
||||
}
|
||||
|
||||
export function createPlaylist(name, scheme){
|
||||
return {
|
||||
type: 'MOPIDY_CREATE_PLAYLIST',
|
||||
name: name,
|
||||
scheme: scheme
|
||||
}
|
||||
}
|
||||
|
||||
export function deletePlaylist( uri ){
|
||||
return {
|
||||
type: 'MOPIDY_DELETE_PLAYLIST',
|
||||
|
||||
@ -830,18 +830,28 @@ const MopidyMiddleware = (function(){
|
||||
.then( response => {
|
||||
store.dispatch(uiActions.createNotification('Created playlist'))
|
||||
|
||||
// re-load our global playlists
|
||||
//store.dispatch({ type: 'MOPIDY_GET_PLAYLISTS' });
|
||||
store.dispatch({
|
||||
type: 'PLAYLIST_LOADED',
|
||||
key: action.uri,
|
||||
playlist: response
|
||||
})
|
||||
|
||||
store.dispatch({
|
||||
type: 'MOPIDY_LIBRARY_PLAYLIST_CREATED',
|
||||
key: action.uri,
|
||||
playlist: response
|
||||
})
|
||||
});
|
||||
break
|
||||
|
||||
case 'MOPIDY_DELETE_PLAYLIST':
|
||||
instruct( socket, store, 'playlists.delete', { uri: action.key })
|
||||
instruct( socket, store, 'playlists.delete', { uri: action.uri })
|
||||
.then( response => {
|
||||
store.dispatch(uiActions.createNotification('Deleted playlist'))
|
||||
|
||||
// re-load our global playlists
|
||||
// store.dispatch({ type: 'MOPIDY_PLAYLISTS' });
|
||||
store.dispatch({
|
||||
type: 'MOPIDY_LIBRARY_PLAYLIST_DELETED',
|
||||
key: action.uri
|
||||
})
|
||||
});
|
||||
break
|
||||
|
||||
|
||||
@ -109,6 +109,22 @@ export default function reducer(mopidy = {}, action){
|
||||
}
|
||||
return Object.assign({}, mopidy, { library_playlists: helpers.removeDuplicates(uris) })
|
||||
|
||||
case 'MOPIDY_LIBRARY_PLAYLIST_CREATED':
|
||||
var library_playlists = []
|
||||
if (mopidy.library_playlists){
|
||||
library_playlists = Object.assign([], mopidy.library_playlists)
|
||||
library_playlists.push(action.key)
|
||||
}
|
||||
return Object.assign({}, mopidy, { library_playlists: library_playlists })
|
||||
|
||||
case 'MOPIDY_LIBRARY_PLAYLIST_DELETED':
|
||||
var library_playlists = []
|
||||
if (mopidy.library_playlists){
|
||||
library_playlists = Object.assign([], mopidy.library_playlists)
|
||||
library_playlists.splice(library_playlists.indexOf(action.uri), 1)
|
||||
}
|
||||
return Object.assign({}, mopidy, { library_playlists: library_playlists })
|
||||
|
||||
case 'MOPIDY_LIBRARY_ARTISTS_LOADED':
|
||||
if (mopidy.library_artists){
|
||||
var uris = [...mopidy.library_artists,...action.uris]
|
||||
|
||||
Reference in New Issue
Block a user