Merge branch 'master' of github.com:jaedb/Iris
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user