diff --git a/pages/admin/roles.vue b/pages/admin/roles.vue index 8d545a5..585232e 100644 --- a/pages/admin/roles.vue +++ b/pages/admin/roles.vue @@ -177,16 +177,18 @@ }); }); }, - handleSizeChange(page) { + handleSizeChange(pageSize) { let _ts = this; _ts.$store.dispatch('admin/fetchRoles', { - page: page + page: _ts.pagination.currentPage, + rows: pageSize }) }, handleCurrentChange(page) { let _ts = this; _ts.$store.dispatch('admin/fetchRoles', { - page: page + page: page, + rows: _ts.pagination.pageSize }) } } diff --git a/pages/admin/users.vue b/pages/admin/users.vue index bad7272..d2876c4 100644 --- a/pages/admin/users.vue +++ b/pages/admin/users.vue @@ -178,16 +178,18 @@ }); }); }, - handleSizeChange(page) { + handleSizeChange(pageSize) { let _ts = this; _ts.$store.dispatch('admin/fetchUsers', { - page: page + page: _ts.pagination.currentPage, + rows: pageSize }) }, handleCurrentChange(page) { let _ts = this; _ts.$store.dispatch('admin/fetchUsers', { - page: page + page: page, + rows: _ts.pagination.pageSize }) }, updateRole() { diff --git a/store/admin.js b/store/admin.js index ce45f70..ba4c39d 100644 --- a/store/admin.js +++ b/store/admin.js @@ -42,9 +42,14 @@ export const actions = { commit('updateUsersData', getDefaultUsersData()) commit('updateFetching', true) + let data = { + page: params.page || 1, + rows: params.rows || 10 + } + return this.$axios .$get(`${ADMIN_API_PATH}/users`, { - params: params + params: data }) .then(response => { commit('updateFetching', false); @@ -60,9 +65,14 @@ export const actions = { commit('updateRolesData', getDefaultRolesData()) commit('updateFetching', true) + let data = { + page: params.page || 1, + rows: params.rows || 10 + } + return this.$axios .$get(`${ADMIN_API_PATH}/roles`, { - params: params + params: data }) .then(response => { commit('updateFetching', false);