diff --git a/apps/block_scout_web/assets/js/lib/async_listing_load.js b/apps/block_scout_web/assets/js/lib/async_listing_load.js index 64cdde754c..f363b7c63c 100644 --- a/apps/block_scout_web/assets/js/lib/async_listing_load.js +++ b/apps/block_scout_web/assets/js/lib/async_listing_load.js @@ -304,21 +304,11 @@ function loadPage (store, path) { function firstPageLoad (store) { const $element = $('[data-async-listing]') function loadItemsNext () { - const path = store.getState().nextPagePath - store.dispatch({ type: 'START_REQUEST' }) - $.getJSON(path, { type: 'JSON' }) - .done(response => store.dispatch(Object.assign({ type: 'ITEMS_FETCHED' }, humps.camelizeKeys(response)))) - .fail(() => store.dispatch({ type: 'REQUEST_ERROR' })) - .always(() => store.dispatch({ type: 'FINISH_REQUEST' })) + loadPage(store, store.getState().nextPagePath) } function loadItemsPrev () { - const path = store.getState().prevPagePath - store.dispatch({ type: 'START_REQUEST' }) - $.getJSON(path, { type: 'JSON' }) - .done(response => store.dispatch(Object.assign({ type: 'ITEMS_FETCHED' }, humps.camelizeKeys(response)))) - .fail(() => store.dispatch({ type: 'REQUEST_ERROR' })) - .always(() => store.dispatch({ type: 'FINISH_REQUEST' })) + loadPage(store, store.getState().prevPagePath) } loadItemsNext()