Snapcast to BEM

This commit is contained in:
James Barnsley
2018-09-24 16:10:42 +12:00
parent 1bb0c80431
commit 06f8ee9060
11 changed files with 1914 additions and 1861 deletions

View File

@ -8,6 +8,16 @@ export function set(data){
}
}
export function request(method, params = null, response_callback = null, error_callback = null){
return {
type: 'MOPIDY_REQUEST',
method: method,
params: params,
response_callback: response_callback,
error_callback: error_callback
}
}
export function connect(){
return {
type: 'MOPIDY_CONNECT'

View File

@ -241,6 +241,28 @@ const MopidyMiddleware = (function(){
})
break;
case 'MOPIDY_REQUEST':
request(socket, store, action.method, action.params)
.then(
response => {
if (action.response_callback){
store.dispatch(action.response_callback.call(this, response));
}
},
error => {
if (action.error_callback){
store.dispatch(action.error_callback.call(this, error));
} else {
store.dispatch(coreActions.handleException(
'Mopidy request failed',
error,
action.method,
action
));
}
}
);
break
/**
* General playback