|
|
@ -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') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|