Files
Iris/src/js/services/spotify/reducer.js
2016-10-16 13:28:21 +13:00

27 lines
752 B
JavaScript
Executable File

export default function reducer(spotify = {}, action){
switch (action.type) {
case 'SPOTIFY_CONNECTING':
return Object.assign({}, spotify, { connected: false, connecting: true });
case 'SPOTIFY_AUTHORIZING':
return Object.assign({}, spotify, { authorizing: true });
case 'SPOTIFY_CONNECTED':
return Object.assign({}, spotify, { connected: true, connecting: false });
case 'SPOTIFY_DISCONNECTED':
return Object.assign({}, spotify, { connected: false, connecting: false });
case 'SPOTIFY_ALBUM_LOADED':
return Object.assign({}, spotify, { album: action.data });
default:
return spotify
}
}