Hooking websocket into react

This commit is contained in:
James Barnsley
2017-02-18 22:04:05 +13:00
parent 16415f8659
commit b1af53fed9
13 changed files with 363 additions and 608 deletions

View File

@ -119,14 +119,15 @@ function refreshToken( dispatch, getState ){
})
.then(
response => {
response.token_expiry = new Date().getTime() + ( response.expires_in * 1000 );
response.source = 'mopidy';
var token = response.spotify_token
token.token_expiry = new Date().getTime() + ( token.expires_in * 1000 );
token.source = 'mopidy';
dispatch({
type: 'SPOTIFY_TOKEN_REFRESHED',
provider: 'mopidy-spotify',
data: response
data: token
});
resolve(response);
resolve(token);
},
error => {
dispatch({ type: 'SPOTIFY_DISCONNECTED' })

View File

@ -92,8 +92,8 @@ const SpotifyMiddleware = (function(){
next(action)
// only resolve if radio is enabled
if( action.data.radio.enabled ){
store.dispatch(spotifyActions.resolveRadioSeeds(action.data.radio))
if( action.radio.enabled ){
store.dispatch(spotifyActions.resolveRadioSeeds(action.radio))
}
break