Backend spotify user refresh borked

This commit is contained in:
James Barnsley
2017-10-15 09:48:33 +13:00
parent 7a92db3934
commit d1c35bbfbb
2 changed files with 11 additions and 11 deletions

View File

@ -1 +1 @@
3.5.2
3.5.3

View File

@ -157,15 +157,8 @@ function refreshToken(dispatch, getState){
$.ajax(config)
.then(
response => {
if (response.type == 'error'){
dispatch({ type: 'SPOTIFY_DISCONNECTED' })
reject({
config: config,
error: response
})
} else {
var token = response.spotify_token
if (response.response_code == 200){
var token = JSON.parse(response.response);
token.token_expiry = new Date().getTime() + (token.expires_in * 1000 );
token.source = 'mopidy';
dispatch({
@ -173,7 +166,14 @@ function refreshToken(dispatch, getState){
access_token_provider: 'backend',
data: token
});
resolve(token);
resolve(token);
} else {
dispatch({ type: 'SPOTIFY_DISCONNECTED' })
reject({
config: config,
error: response
})
}
},