useEffect to trigger API call (needs delay for mopidy_connected)

This commit is contained in:
James Barnsley
2020-08-10 21:00:31 +12:00
parent 584b3ea7c4
commit 86aad6df0e
8 changed files with 83 additions and 45 deletions

View File

@ -115,14 +115,18 @@ export function cachebustHttpStream() {
* relevant service to load the record - all from one neat package.
* */
export function loadItem(uri, force_reload = false) {
export function loadItems(uris, force_reload = false) {
return {
type: 'LOAD_ITEM',
uri,
type: 'LOAD_ITEMS',
uris,
force_reload,
};
}
export function loadItem(uri, force_reload = false) {
return loadItems([uri], force_reload);
}
export function loadTrack(uri, force_reload = false) {
return {
type: 'LOAD_TRACK',

View File

@ -321,11 +321,13 @@ const CoreMiddleware = (function () {
* assets. This is where we can return already indexed records
* where appropriate
* */
case 'LOAD_ITEM':
store.dispatch(coreActions[`load${titleCase(uriType(action.uri))}`](
action.uri,
action.force_reload,
));
case 'LOAD_ITEMS':
action.uris.forEach((uri) => {
store.dispatch(coreActions[`load${titleCase(uriType(uri))}`](
uri,
action.force_reload,
));
});
break;
case 'LOAD_TRACK':