From dfde8d8cf92ac4f9de1925575d881a64df6c9e49 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Mon, 4 Dec 2017 07:58:48 +1300 Subject: [PATCH] Debugging Spotify API outage --- src/js/App.js | 2 +- src/js/services/spotify/actions.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/js/App.js b/src/js/App.js index d00bbbff..30ddb0b7 100755 --- a/src/js/App.js +++ b/src/js/App.js @@ -66,7 +66,7 @@ class App extends React.Component{ // Check for url-parsed configuration values var url_vars = this.props.location.query; - if (url_vars !== undefined){ + if (url_vars !== undefined && url_vars.host !== undefined && url_vars.port !== undefined){ this.props.mopidyActions.setConfig(url_vars); hashHistory.push(global.baseURL); } diff --git a/src/js/services/spotify/actions.js b/src/js/services/spotify/actions.js index c8dbdf5d..ca21bac0 100755 --- a/src/js/services/spotify/actions.js +++ b/src/js/services/spotify/actions.js @@ -35,7 +35,8 @@ const sendRequest = (dispatch, getState, endpoint, method = 'GET', data = false) cached: true, timeout: 30000, headers: { - Authorization: 'Bearer '+ response + Authorization: 'Bearer '+ response, + Accept: 'application/json' } } @@ -330,9 +331,9 @@ export function getFeaturedPlaylists(){ var sec = date.getSeconds(); if (sec < 10 ) sec = '0'+sec; - var timestamp = year+'-'+month+'-'+day+'T'+hour+':'+min+':'+sec; + var timestamp = year+'-'+month+'-'+day+'T'+hour+':00:00'; - sendRequest(dispatch, getState, 'browse/featured-playlists?timestamp='+timestamp+'&country='+getState().core.country+'&limit=50&locale='+getState().core.locale ) + sendRequest(dispatch, getState, 'browse/featured-playlists?limit=50&country='+getState().core.country+'&locale='+getState().core.locale+'timestamp='+timestamp) .then( response => { var playlists = []