Detect non-authorized Genius rather than triggering error
This commit is contained in:
@ -57,8 +57,8 @@ export default class GridItem extends React.Component{
|
||||
case 'artist':
|
||||
return (
|
||||
<span>
|
||||
{item.followers ? item.followers.toLocaleString()+' followers' : null}
|
||||
{item.albums_uris ? item.albums_uris.length+' albums' : null}
|
||||
{item.followers !== undefined ? item.followers.toLocaleString()+' followers' : null}
|
||||
{item.albums_uris !== undefined ? item.albums_uris.length+' albums' : null}
|
||||
</span>
|
||||
)
|
||||
break
|
||||
@ -66,7 +66,7 @@ export default class GridItem extends React.Component{
|
||||
case 'album':
|
||||
return (
|
||||
<span>
|
||||
{item.artists ? <ArtistSentence artists={item.artists} /> : null}
|
||||
{item.artists !== undefined ? <ArtistSentence artists={item.artists} /> : null}
|
||||
</span>
|
||||
)
|
||||
break
|
||||
@ -74,8 +74,8 @@ export default class GridItem extends React.Component{
|
||||
default:
|
||||
return (
|
||||
<span>
|
||||
{ item.artists ? <ArtistSentence artists={ item.artists } /> : null }
|
||||
{ item.followers ? item.followers.toLocaleString()+' followers' : null }
|
||||
{ item.artists !== undefined ? <ArtistSentence artists={ item.artists } /> : null }
|
||||
{ item.followers !== undefined ? item.followers.toLocaleString()+' followers' : null }
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ export let formatArtist = function(data){
|
||||
artist.images = formatImages(artist.images);
|
||||
}
|
||||
|
||||
if (data.followers && data.followers.total){
|
||||
if (data.followers && data.followers.total !== undefined){
|
||||
artist.followers = data.followers.total;
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
var coreActions = require('../core/actions')
|
||||
var uiActions = require('../ui/actions')
|
||||
var helpers = require('../../helpers')
|
||||
var coreActions = require('../core/actions');
|
||||
var uiActions = require('../ui/actions');
|
||||
var helpers = require('../../helpers');
|
||||
|
||||
export function set(data){
|
||||
return {
|
||||
@ -202,7 +202,7 @@ export function getTrackLyrics(uri, path){
|
||||
|
||||
export function findTrackLyrics(track){
|
||||
return (dispatch, getState) => {
|
||||
|
||||
|
||||
var query = '';
|
||||
query += track.artists[0].name+' ';
|
||||
query += track.name;
|
||||
|
||||
@ -57,7 +57,7 @@ class Track extends React.Component{
|
||||
if (nextProps.params.uri != this.props.params.uri){
|
||||
this.props.coreActions.loadTrack(nextProps.params.uri);
|
||||
|
||||
if (nextProps.tracks.artists){
|
||||
if (nextProps.genius_authorized && nextProps.tracks.artists){
|
||||
this.props.geniusActions.findTrackLyrics(nextProps.track);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user