diff options
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); }, |