Detect authorization before we ask for /following
This commit is contained in:
@ -344,7 +344,10 @@ const CoreMiddleware = (function(){
|
||||
switch (helpers.uriSource(action.uri)){
|
||||
case 'spotify':
|
||||
store.dispatch(spotifyActions.getTrack(action.uri));
|
||||
store.dispatch(spotifyActions.following(action.uri));
|
||||
|
||||
if (store.getState().spotify.me){
|
||||
store.dispatch(spotifyActions.following(action.uri));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -370,7 +373,10 @@ const CoreMiddleware = (function(){
|
||||
switch (helpers.uriSource(action.uri)){
|
||||
case 'spotify':
|
||||
store.dispatch(spotifyActions.getAlbum(action.uri));
|
||||
store.dispatch(spotifyActions.following(action.uri));
|
||||
|
||||
if (store.getState().spotify.me){
|
||||
store.dispatch(spotifyActions.following(action.uri));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -397,7 +403,10 @@ const CoreMiddleware = (function(){
|
||||
switch (helpers.uriSource(action.uri)){
|
||||
case 'spotify':
|
||||
store.dispatch(spotifyActions.getArtist(action.uri, true));
|
||||
store.dispatch(spotifyActions.following(action.uri));
|
||||
|
||||
if (store.getState().spotify.me){
|
||||
store.dispatch(spotifyActions.following(action.uri));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -423,7 +432,10 @@ const CoreMiddleware = (function(){
|
||||
switch (helpers.uriSource(action.uri)){
|
||||
case 'spotify':
|
||||
store.dispatch(spotifyActions.getPlaylist(action.uri));
|
||||
store.dispatch(spotifyActions.following(action.uri));
|
||||
|
||||
if (store.getState().spotify.me){
|
||||
store.dispatch(spotifyActions.following(action.uri));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -448,7 +460,10 @@ const CoreMiddleware = (function(){
|
||||
switch (helpers.uriSource(action.uri)){
|
||||
case 'spotify':
|
||||
store.dispatch(spotifyActions.getUser(action.uri));
|
||||
store.dispatch(spotifyActions.following(action.uri));
|
||||
|
||||
if (store.getState().spotify.me){
|
||||
store.dispatch(spotifyActions.following(action.uri));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@ -364,7 +364,7 @@ export function getFeaturedPlaylists(){
|
||||
type: 'SPOTIFY_FEATURED_PLAYLISTS_LOADED',
|
||||
data: {
|
||||
message: response.message,
|
||||
playlists: helpers.arrayOf('uri',response.playlists.items)
|
||||
playlists: helpers.upgradePlaylistsUris(helpers.arrayOf('uri',response.playlists.items))
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -738,7 +738,7 @@ export function following(uri, method = 'GET'){
|
||||
} else {
|
||||
endpoint = 'playlists/'+ helpers.getFromUri('playlistid',uri) +'/followers'
|
||||
}
|
||||
break
|
||||
break;
|
||||
}
|
||||
|
||||
sendRequest(dispatch, getState, endpoint, method, data)
|
||||
|
||||
@ -195,11 +195,15 @@ const SpotifyMiddleware = (function(){
|
||||
case 'SPOTIFY_CATEGORY_PLAYLISTS_LOADED':
|
||||
store.dispatch(coreActions.playlistsLoaded(action.playlists.items));
|
||||
|
||||
action.uris = helpers.arrayOf('uri',action.playlists.items);
|
||||
console.log(action);
|
||||
action.uris = helpers.arrayOf('uri', action.playlists.items);
|
||||
action.more = action.playlists.next;
|
||||
action.total = action.playlists.total;
|
||||
delete action.playlists;
|
||||
|
||||
// Upgrade our URIs
|
||||
action.uris = helpers.upgradePlaylistsUris(action.uris);
|
||||
|
||||
next(action);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user