Commit 15c0a6d8 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Set pagination only when loading the app

parent 72c9454e
...@@ -33,6 +33,7 @@ $(() => { ...@@ -33,6 +33,7 @@ $(() => {
methods: { methods: {
fetchGroups(parentGroup) { fetchGroups(parentGroup) {
let parentId = null; let parentId = null;
let getGroups = null;
if (parentGroup) { if (parentGroup) {
parentId = parentGroup.id; parentId = parentGroup.id;
...@@ -40,14 +41,15 @@ $(() => { ...@@ -40,14 +41,15 @@ $(() => {
const page = gl.utils.getParameterByName('page'); const page = gl.utils.getParameterByName('page');
service.getGroups(parentId, page) getGroups = service.getGroups(parentId, page);
.then((response) => { getGroups.then((response) => {
store.setGroups(response.json(), parentGroup); store.setGroups(response.json(), parentGroup);
store.storePagination(response.headers); })
}) .catch(() => {
.catch(() => { // TODO: Handler error
// TODO: Handler error });
});
return getGroups;
}, },
toggleSubGroups(parentGroup = null) { toggleSubGroups(parentGroup = null) {
if (!parentGroup.isOpen) { if (!parentGroup.isOpen) {
...@@ -57,10 +59,18 @@ $(() => { ...@@ -57,10 +59,18 @@ $(() => {
}, },
}, },
created() { created() {
const groupFilterList = new GroupFilterableList(form, filter, holder, store); let groupFilterList = null;
groupFilterList = new GroupFilterableList(form, filter, holder, store);
groupFilterList.initSearch(); groupFilterList.initSearch();
this.fetchGroups(); this.fetchGroups()
.then((response) => {
store.storePagination(response.headers);
})
.catch(() => {
// TODO: Handle error
});
eventHub.$on('toggleSubGroups', this.toggleSubGroups); eventHub.$on('toggleSubGroups', this.toggleSubGroups);
}, },
......
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