From abb6811ef923285521989f59e18cf3a7f864a67f Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 21 May 2019 12:56:41 +0300 Subject: [PATCH] fix eslint --- .../assets/js/lib/async_listing_load.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) 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 bd02b9cf8d..297ebe7fcb 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 @@ -84,14 +84,10 @@ export function asyncReducer (state = asyncInitialState, action) { case 'ITEMS_FETCHED': { var prevPagePath = null - console.log(state.pagesStack) - if (state.pagesStack.length >= 2) { prevPagePath = state.pagesStack[state.pagesStack.length - 2] } - console.log(state.pagesStack) - return Object.assign({}, state, { requestError: false, items: action.items, @@ -100,10 +96,9 @@ export function asyncReducer (state = asyncInitialState, action) { }) } case 'NAVIGATE_TO_OLDER': { - console.log('NAVIGATE_TO_OLDER') history.replaceState({}, null, state.nextPagePath) - if (state.pagesStack.length == 0) { + if (state.pagesStack.length === 0) { state.pagesStack.push(window.location.href.split('?')[0]) } @@ -195,7 +190,7 @@ export const elements = { '[data-async-listing] [data-page-number]': { render ($el, state) { - if (state.pagesStack.length == 0) { + if (state.pagesStack.length === 0) { return $el.text('Page 1') } @@ -255,9 +250,9 @@ function firstPageLoad (store) { 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'})) + .done(response => store.dispatch(Object.assign({type: 'ITEMS_FETCHED'}, humps.camelizeKeys(response)))) + .fail(() => store.dispatch({type: 'REQUEST_ERROR'})) + .always(() => store.dispatch({type: 'FINISH_REQUEST'})) } loadItemsNext()