Commit b9bfdd85 authored by Eliurkis Diaz's avatar Eliurkis Diaz Committed by Evan You

Refactor code (#195)

parent 253a3aad
...@@ -3,14 +3,16 @@ export default { ...@@ -3,14 +3,16 @@ export default {
// current list type and current pagination // current list type and current pagination
activeIds (state) { activeIds (state) {
const { activeType, itemsPerPage, lists } = state const { activeType, itemsPerPage, lists } = state
const page = Number(state.route.params.page) || 1
if (activeType) { if (!activeType) {
const start = (page - 1) * itemsPerPage
const end = page * itemsPerPage
return lists[activeType].slice(start, end)
} else {
return [] return []
} }
const page = Number(state.route.params.page) || 1
const start = (page - 1) * itemsPerPage
const end = page * itemsPerPage
return lists[activeType].slice(start, end)
}, },
// items that should be currently displayed. // items that should be currently displayed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment