This commit is contained in:
James Barnsley
2016-11-03 08:57:16 +13:00
parent c731199401
commit 8f5e61a8f9
17 changed files with 6666 additions and 5999 deletions

View File

@ -501,7 +501,7 @@ export function getNewReleases(){
}
export function getURL( url, action_name ){
return (dispatch, getState) => {
return (dispatch, getState) => {
sendRequest( dispatch, getState, url )
.then( response => {
dispatch({
@ -509,5 +509,26 @@ export function getURL( url, action_name ){
data: response
});
});
}
}
export function getSearchResults( query, type = 'album,artist,playlist,track', limit = 50, offset = 0 ){
return (dispatch, getState) => {
dispatch({ type: 'SPOTIFY_SEARCH_RESULTS_LOADED', data: false });
var url = 'search?q='+query
url += '&type='+type
url += '&country='+getState().spotify.country
url += '&limit='+limit
url += '&offset='+offset
sendRequest( dispatch, getState, url )
.then( response => {
dispatch({
type: 'SPOTIFY_SEARCH_RESULTS_LOADED',
data: response
});
});
}
}