Commit 36ccb34a authored by Sebastien Chopin's avatar Sebastien Chopin

Fix pagination

parent 869330ae
...@@ -69,6 +69,7 @@ export default { ...@@ -69,6 +69,7 @@ export default {
watch: { watch: {
page(to, from) { page(to, from) {
console.log('Page changed', to, from)
this.loadItems(to, from) this.loadItems(to, from)
} }
}, },
......
...@@ -28,6 +28,7 @@ module.exports = { ...@@ -28,6 +28,7 @@ module.exports = {
'@nuxtjs/component-cache' '@nuxtjs/component-cache'
], ],
plugins: [ plugins: [
'~plugins/vuex-router-sync.js',
'~plugins/filters.js' '~plugins/filters.js'
], ],
render: { render: {
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
"firebase": "^4.1.1", "firebase": "^4.1.1",
"nuxt": "1.0.0-alpha.3", "nuxt": "1.0.0-alpha.3",
"stylus": "^0.54.5", "stylus": "^0.54.5",
"stylus-loader": "^3.0.1" "stylus-loader": "^3.0.1",
"vuex-router-sync": "^4.2.0"
} }
} }
import Vue from 'vue'
import { sync } from 'vuex-router-sync'
export default function ({ app, store }) {
sync(store, app.router)
}
...@@ -8,7 +8,7 @@ export default { ...@@ -8,7 +8,7 @@ export default {
return [] return []
} }
const page = 1 // Number(state.route.params.page) || 1 const page = Number(state.route.params.page) || 1
const start = (page - 1) * itemsPerPage const start = (page - 1) * itemsPerPage
const end = page * itemsPerPage const end = page * itemsPerPage
......
...@@ -4277,6 +4277,10 @@ vue@~2.3.3: ...@@ -4277,6 +4277,10 @@ vue@~2.3.3:
version "2.3.3" version "2.3.3"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.3.3.tgz#d1eaa8fde5240735a4563e74f2c7fead9cbb064c" resolved "https://registry.yarnpkg.com/vue/-/vue-2.3.3.tgz#d1eaa8fde5240735a4563e74f2c7fead9cbb064c"
vuex-router-sync@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/vuex-router-sync/-/vuex-router-sync-4.2.0.tgz#ebfc497d69b4018a9266a8f18b54bfca4d52125f"
vuex@^2.3.1: vuex@^2.3.1:
version "2.3.1" version "2.3.1"
resolved "https://registry.yarnpkg.com/vuex/-/vuex-2.3.1.tgz#cde8e997c1f9957719bc7dea154f9aa691d981a6" resolved "https://registry.yarnpkg.com/vuex/-/vuex-2.3.1.tgz#cde8e997c1f9957719bc7dea154f9aa691d981a6"
......
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