Playlist loader; Logging; Mopidy search
This commit is contained in:
@ -138,6 +138,8 @@ export function connect(){
|
||||
|
||||
dispatch({ type: 'SPOTIFY_CONNECTING' });
|
||||
|
||||
// send a generic request to ensure spotify is up and running
|
||||
// there is no 'test' or 'ping' endpoint on the Spotify API
|
||||
sendRequest( dispatch, getState, 'browse/categories?limit=1' )
|
||||
.then( response => {
|
||||
dispatch({
|
||||
|
||||
@ -61,9 +61,29 @@ export default function reducer(spotify = {}, action){
|
||||
case 'SPOTIFY_PLAYLIST_LOADED':
|
||||
return Object.assign({}, spotify, { playlist: action.data });
|
||||
|
||||
case 'SPOTIFY_PLAYLIST_LOADED_MORE':
|
||||
var playlist = spotify.playlist
|
||||
Object.assign(playlist, { tracks: {
|
||||
href: action.data.href,
|
||||
next: action.data.next,
|
||||
previous: action.data.previous,
|
||||
items: [ ...spotify.playlist.tracks.items, ...action.data.items ]
|
||||
}})
|
||||
return Object.assign({}, spotify, { playlist: playlist });
|
||||
|
||||
case 'SPOTIFY_ALBUM_LOADED':
|
||||
return Object.assign({}, spotify, { album: action.data });
|
||||
|
||||
case 'SPOTIFY_ALBUM_LOADED_MORE':
|
||||
var album = spotify.album
|
||||
Object.assign(album, { tracks: {
|
||||
href: action.data.href,
|
||||
next: action.data.next,
|
||||
previous: action.data.previous,
|
||||
items: [ ...spotify.album.tracks.items, ...action.data.items ]
|
||||
}})
|
||||
return Object.assign({}, spotify, { album: album });
|
||||
|
||||
case 'SPOTIFY_ARTIST_LOADED':
|
||||
return Object.assign({}, spotify, { artist: action.data });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user