diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2017-05-30 00:52:33 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2017-05-30 00:52:33 +0300 |
commit | 15c0a6d826be63089963175a0ce1fa6fbafd23f8 (patch) | |
tree | 7c7ff60a0b4b7bd53ca4037c06f14f36aa0b6f1e /app/assets/javascripts/groups | |
parent | 72c9454eefa91d959cceae898ed2f0ab419f2a75 (diff) |
Set pagination only when loading the app
Diffstat (limited to 'app/assets/javascripts/groups')
-rw-r--r-- | app/assets/javascripts/groups/index.js | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/app/assets/javascripts/groups/index.js b/app/assets/javascripts/groups/index.js index e8a9191c3b5..35eac409afa 100644 --- a/app/assets/javascripts/groups/index.js +++ b/app/assets/javascripts/groups/index.js @@ -33,6 +33,7 @@ $(() => { methods: { fetchGroups(parentGroup) { let parentId = null; + let getGroups = null; if (parentGroup) { parentId = parentGroup.id; @@ -40,14 +41,15 @@ $(() => { const page = gl.utils.getParameterByName('page'); - service.getGroups(parentId, page) - .then((response) => { - store.setGroups(response.json(), parentGroup); - store.storePagination(response.headers); - }) - .catch(() => { - // TODO: Handler error - }); + getGroups = service.getGroups(parentId, page); + getGroups.then((response) => { + store.setGroups(response.json(), parentGroup); + }) + .catch(() => { + // TODO: Handler error + }); + + return getGroups; }, toggleSubGroups(parentGroup = null) { if (!parentGroup.isOpen) { @@ -57,10 +59,18 @@ $(() => { }, }, created() { - const groupFilterList = new GroupFilterableList(form, filter, holder, store); + let groupFilterList = null; + + groupFilterList = new GroupFilterableList(form, filter, holder, store); groupFilterList.initSearch(); - this.fetchGroups(); + this.fetchGroups() + .then((response) => { + store.storePagination(response.headers); + }) + .catch(() => { + // TODO: Handle error + }); eventHub.$on('toggleSubGroups', this.toggleSubGroups); }, |