LastFM love button, API failing

This commit is contained in:
James Barnsley
2017-11-04 22:09:51 +13:00
parent a50c8b454e
commit 37082f2c38
4 changed files with 197 additions and 30 deletions

View File

@ -264,11 +264,7 @@ export function getMe(){
**/
export function getTrack(uri){
return (dispatch, getState) => {
// flush out the previous store value
dispatch({ type: 'SPOTIFY_TRACK_LOADED', data: false });
sendRequest(dispatch, getState, 'tracks/'+ helpers.getFromUri('trackid', uri) )
sendRequest(dispatch, getState, 'tracks/'+ helpers.getFromUri('trackid', uri))
.then(
response => {
let track = Object.assign(
@ -677,6 +673,13 @@ export function following(uri, method = 'GET'){
var asset_name = helpers.uriType(uri);
var endpoint, data
switch(asset_name){
case 'track':
if (method == 'GET'){
endpoint = 'me/tracks/contains/?ids='+ helpers.getFromUri('trackid', uri)
} else {
endpoint = 'me/tracks/?ids='+ helpers.getFromUri('trackid', uri)
}
break
case 'album':
if (method == 'GET'){
endpoint = 'me/albums/contains/?ids='+ helpers.getFromUri('albumid', uri)
@ -709,7 +712,7 @@ export function following(uri, method = 'GET'){
break
}
sendRequest(dispatch, getState, endpoint, method, data )
sendRequest(dispatch, getState, endpoint, method, data)
.then(
response => {
if (response ) is_following = response