pull/1974/head
Ayrat Badykov 6 years ago
parent e18f2ff541
commit abb6811ef9
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 9
      apps/block_scout_web/assets/js/lib/async_listing_load.js

@ -84,14 +84,10 @@ export function asyncReducer (state = asyncInitialState, action) {
case 'ITEMS_FETCHED': { case 'ITEMS_FETCHED': {
var prevPagePath = null var prevPagePath = null
console.log(state.pagesStack)
if (state.pagesStack.length >= 2) { if (state.pagesStack.length >= 2) {
prevPagePath = state.pagesStack[state.pagesStack.length - 2] prevPagePath = state.pagesStack[state.pagesStack.length - 2]
} }
console.log(state.pagesStack)
return Object.assign({}, state, { return Object.assign({}, state, {
requestError: false, requestError: false,
items: action.items, items: action.items,
@ -100,10 +96,9 @@ export function asyncReducer (state = asyncInitialState, action) {
}) })
} }
case 'NAVIGATE_TO_OLDER': { case 'NAVIGATE_TO_OLDER': {
console.log('NAVIGATE_TO_OLDER')
history.replaceState({}, null, state.nextPagePath) history.replaceState({}, null, state.nextPagePath)
if (state.pagesStack.length == 0) { if (state.pagesStack.length === 0) {
state.pagesStack.push(window.location.href.split('?')[0]) state.pagesStack.push(window.location.href.split('?')[0])
} }
@ -195,7 +190,7 @@ export const elements = {
'[data-async-listing] [data-page-number]': { '[data-async-listing] [data-page-number]': {
render ($el, state) { render ($el, state) {
if (state.pagesStack.length == 0) { if (state.pagesStack.length === 0) {
return $el.text('Page 1') return $el.text('Page 1')
} }

Loading…
Cancel
Save