Revamp of asset designs

This commit is contained in:
James Barnsley
2017-02-07 10:00:29 +13:00
parent 008ae09fda
commit cfdccc0d85
12 changed files with 104 additions and 120 deletions

View File

@ -130,13 +130,13 @@ const PusherMiddleware = (function(){
request({ action: 'get_version' })
.then(
response => {
store.dispatch({ type: 'VERSION', version: response.data.version })
store.dispatch({ type: 'VERSION', data: response.data })
}
)
request({ action: 'get_radio' })
.then(
response => {
store.dispatch({ type: 'RADIO', radio: response.data.radio })
store.dispatch({ type: 'RADIO', data: response.data })
}
)
return next(action);
@ -155,7 +155,7 @@ const PusherMiddleware = (function(){
}else{
store.dispatch( uiActions.createNotification('Upgrade failed, please upgrade manually','bad') )
}
store.dispatch({ type: 'VERSION', version: response.data.version })
store.dispatch({ type: 'VERSION', data: response.data })
}
)
return next(action);

View File

@ -86,15 +86,14 @@ const SpotifyMiddleware = (function(){
}
break
// when our mopidy server current track changes
// when radio returns
case 'RADIO':
// proceed as usual so we don't inhibit default functionality
next(action)
// only resolve if radio is enabled
if( action.radio.enabled ){
store.dispatch(spotifyActions.resolveRadioSeeds(action.radio))
if( action.data.radio.enabled ){
store.dispatch(spotifyActions.resolveRadioSeeds(action.data.radio))
}
break

View File

@ -210,8 +210,8 @@ const UIMiddleware = (function(){
break
case 'VERSION':
if( action.version.upgrade_available )
store.dispatch( uiActions.createNotification( 'Version '+action.version.latest+' is available. See settings to upgrade.' ) )
if( action.data.version.upgrade_available )
store.dispatch( uiActions.createNotification( 'Version '+action.data.version.latest+' is available. See settings to upgrade.' ) )
next( action )
break

View File

@ -121,7 +121,7 @@ export default function reducer(ui = {}, action){
case 'RADIO':
case 'START_RADIO':
return Object.assign({}, ui, { seeds_resolved: false }, { radio: action.radio })
return Object.assign({}, ui, { seeds_resolved: false }, { radio: action.data.radio })
case 'RADIO_SEEDS_RESOLVED':
var radio = Object.assign({}, ui.radio, { resolved_seeds: action.resolved_seeds })