Process action naming convention

This commit is contained in:
James Barnsley
2020-02-13 10:41:20 +13:00
parent c4486e4007
commit 571c857814
16 changed files with 559 additions and 342 deletions

View File

@ -6,7 +6,7 @@ const coreActions = require('../core/actions');
const mopidyActions = require('../mopidy/actions');
const uiActions = require('../ui/actions');
const GoogleMiddleware = (function () {
const GoogleMiddleware = (function () {
// A Google request is an alias of the Mopidy request
const request = (store, method, params = null, response_callback = null, error_callback = null) => {
store.dispatch(
@ -16,7 +16,7 @@ const GoogleMiddleware = (function () {
response_callback,
error_callback,
),
);
);
};
return (store) => (next) => (action) => {
@ -55,10 +55,10 @@ const GoogleMiddleware = (function () {
},
));
},
);
} else if (last_run.status == 'cancelled') {
);
} else if (last_run.status === 'cancelled') {
store.dispatch(uiActions.resumeProcess('GOOGLE_LIBRARY_ALBUMS_PROCESSOR'));
} else if (last_run.status == 'finished') {
} else if (last_run.status === 'finished') {
// TODO: do we want to force a refresh?
}
@ -68,7 +68,7 @@ const GoogleMiddleware = (function () {
if (store.getState().ui.processes.GOOGLE_LIBRARY_ALBUMS_PROCESSOR !== undefined) {
const processor = store.getState().ui.processes.GOOGLE_LIBRARY_ALBUMS_PROCESSOR;
if (processor.status == 'cancelling') {
if (processor.status === 'cancelling') {
store.dispatch(uiActions.processCancelled('GOOGLE_LIBRARY_ALBUMS_PROCESSOR'));
return false;
}
@ -88,7 +88,7 @@ const GoogleMiddleware = (function () {
));
store.dispatch(mopidyActions.getAlbums(uris_to_load, { name: 'GOOGLE_LIBRARY_ALBUMS_PROCESSOR', data: { uris } }));
} else {
store.dispatch(uiActions.processFinishing('GOOGLE_LIBRARY_ALBUMS_PROCESSOR'));
store.dispatch(uiActions.processFinished('GOOGLE_LIBRARY_ALBUMS_PROCESSOR'));
}
break;
@ -106,7 +106,7 @@ const GoogleMiddleware = (function () {
}
const uris = [];
for (let i = 0; i < response.length; i++) {
for (let i = 0; i < response.length; i++) {
// Convert local URI to actual artist URI
// See https://github.com/mopidy/mopidy-local-sqlite/issues/39
response[i].uri = response[i].uri.replace('local:directory?albumartist=', '');
@ -134,7 +134,7 @@ const GoogleMiddleware = (function () {
default:
return next(action);
}
};
};
}());
export default GoogleMiddleware;