diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-07-12 17:47:09 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-07-12 17:47:09 +0300 |
commit | aaa78199c2408a05d81aa4ee3058e81bb732da16 (patch) | |
tree | 97146599b47da2f86a1701c6012f60103bad9352 /app/assets/javascripts/groups | |
parent | fd692d10663e5d3c7dc0de9221d6231b7fbcc464 (diff) |
Update vue-resource
Diffstat (limited to 'app/assets/javascripts/groups')
-rw-r--r-- | app/assets/javascripts/groups/index.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/assets/javascripts/groups/index.js b/app/assets/javascripts/groups/index.js index ff601db2aa6..00e1bd94c9c 100644 --- a/app/assets/javascripts/groups/index.js +++ b/app/assets/javascripts/groups/index.js @@ -99,8 +99,10 @@ document.addEventListener('DOMContentLoaded', () => { page: currentPath, }, document.title, currentPath); - this.updateGroups(response.json()); - this.updatePagination(response.headers); + return response.json().then((data) => { + this.updateGroups(data); + this.updatePagination(response.headers); + }); }) .catch(this.handleErrorResponse); }, @@ -114,18 +116,19 @@ document.addEventListener('DOMContentLoaded', () => { }, leaveGroup(group, collection) { this.service.leaveGroup(group.leavePath) + .then(resp => resp.json()) .then((response) => { $.scrollTo(0); this.store.removeGroup(group, collection); // eslint-disable-next-line no-new - new Flash(response.json().notice, 'notice'); + new Flash(response.notice, 'notice'); }) - .catch((response) => { + .catch((error) => { let message = 'An error occurred. Please try again.'; - if (response.status === 403) { + if (error.status === 403) { message = 'Failed to leave the group. Please make sure you are not the only owner'; } |