UI actions; Context menu

This commit is contained in:
James Barnsley
2016-10-27 10:02:12 +13:00
parent 05e131ce75
commit 560fb4df19
19 changed files with 378 additions and 46 deletions

View File

@ -405,7 +405,7 @@ export function getCategory( id ){
}
export function getCategoryPlaylists( id ){
return (dispatch, getState) => {
return (dispatch, getState) => {
dispatch({ type: 'SPOTIFY_CATEGORY_PLAYLISTS_LOADED', data: false });
@ -416,6 +416,21 @@ export function getCategoryPlaylists( id ){
data: response.playlists
});
});
}
}
export function getNewReleases(){
return (dispatch, getState) => {
dispatch({ type: 'SPOTIFY_NEW_RELEASES_LOADED', data: false });
sendRequest( dispatch, getState, 'browse/new-releases?country='+getState().spotify.country+'&limit=50' )
.then( response => {
dispatch({
type: 'SPOTIFY_NEW_RELEASES_LOADED',
data: response.albums
});
});
}
}

View File

@ -82,6 +82,9 @@ export default function reducer(spotify = {}, action){
case 'SPOTIFY_CATEGORY_PLAYLISTS_LOADED':
return Object.assign({}, spotify, { category_playlists: action.data });
case 'SPOTIFY_NEW_RELEASES_LOADED':
return Object.assign({}, spotify, { new_releases: action.data });
default:
return spotify
}