Merge branch 'master' of github.com:jaedb/Iris

This commit is contained in:
James Barnsley
2017-02-07 07:27:40 +13:00
24 changed files with 194 additions and 101 deletions

View File

@ -1,4 +1,5 @@
var uiActions = require('../../services/ui/actions.js')
var helpers = require('../../helpers.js')
/**
@ -39,6 +40,7 @@ const sendRequest = ( dispatch, getState, endpoint, method = 'GET', data = false
},
(xhr, status, error) => {
console.error( endpoint+' failed', xhr.responseText)
dispatch(uiActions.createNotification(xhr.responseText,'bad'))
reject(error)
}
)
@ -98,6 +100,7 @@ function refreshToken( dispatch, getState ){
},
error => {
dispatch({ type: 'SPOTIFY_DISCONNECTED' })
dispatch(uiActions.createNotification('Could not refresh token','bad'))
console.error('Could not refresh token', error)
reject(error)
}
@ -124,6 +127,7 @@ function refreshToken( dispatch, getState ){
},
error => {
dispatch({ type: 'SPOTIFY_DISCONNECTED' })
dispatch(uiActions.createNotification('Could not refresh token','bad'))
console.error('Could not refresh token', error)
reject(error)
}

View File

@ -93,8 +93,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

View File

@ -12,6 +12,9 @@ export default function reducer(spotify = {}, action){
case 'SPOTIFY_DISCONNECTED':
return Object.assign({}, spotify, { connected: false, connecting: false })
case 'SPOTIFY_SET_CONFIG':
return Object.assign({}, spotify, action.config)
case 'PUSHER_SPOTIFY_TOKEN':
if( spotify.authorized ) return spotify;
return Object.assign({}, spotify, {