Headings on responsive (flex); GridItem trigger image load
This commit is contained in:
@ -25,8 +25,7 @@ const sendRequest = (dispatch, getState, endpoint, params) => new Promise((resol
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'User-Agent': 'Iris/1.0',
|
||||
'Authorization': `Discogs key=${key}, secret=${secret}`,
|
||||
'X-Cache': 'true',
|
||||
'Authorization': `Discogs key=${key}, secret=${secret}`
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@ -2111,7 +2111,11 @@ const MopidyMiddleware = (function () {
|
||||
const existing_artist = store.getState().core.artists[artist.uri];
|
||||
if (existing_artist) {
|
||||
if (!existing_artist.images) {
|
||||
store.dispatch(discogsActions.getArtistImages(artist.uri, artist));
|
||||
if (store.getState().spotify.access_token) {
|
||||
store.dispatch(spotifyActions.getArtistImages(artist));
|
||||
} else {
|
||||
store.dispatch(discogsActions.getArtistImages(artist.uri, artist));
|
||||
}
|
||||
}
|
||||
|
||||
// Get biography and other stats from LastFM
|
||||
|
||||
@ -1177,6 +1177,29 @@ export function getArtists(uris) {
|
||||
};
|
||||
}
|
||||
|
||||
// Used to get images for non-Spotify artists
|
||||
export function getArtistImages(artist) {
|
||||
return (dispatch, getState) => {
|
||||
request(dispatch, getState, `search?q=${artist.name}&type=artist`)
|
||||
.then(response => {
|
||||
if (response.artists.items) {
|
||||
const updatedArtist = {
|
||||
uri: artist.uri,
|
||||
images: response.artists.items[0].images,
|
||||
}
|
||||
dispatch(coreActions.artistLoaded(updatedArtist));
|
||||
}
|
||||
},
|
||||
error => {
|
||||
dispatch(coreActions.handleException(
|
||||
'Could not load artists',
|
||||
error,
|
||||
));
|
||||
},
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export function playArtistTopTracks(uri) {
|
||||
return (dispatch, getState) => {
|
||||
|
||||
Reference in New Issue
Block a user