summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-05-12 13:04:36 +0100
committerPhil Hughes <me@iamphill.com>2017-05-12 13:04:44 +0100
commit74cff4ff4e91e90516e07dfe4196597f4b47704b (patch)
treef6b05b9de4ee6035c021edceb2cbd91c7b5d652d
parentda38cea22cb225429f538105478e54c7cbb28cbf (diff)
downloadgitlab-ce-issue-edit-inline-form-btns.tar.gz
Moved json parsing out of serviceissue-edit-inline-form-btns
[ci skip]
-rw-r--r--app/assets/javascripts/issue_show/components/app.vue1
-rw-r--r--app/assets/javascripts/issue_show/services/index.js6
-rw-r--r--spec/javascripts/issue_show/components/app_spec.js8
3 files changed, 9 insertions, 6 deletions
diff --git a/app/assets/javascripts/issue_show/components/app.vue b/app/assets/javascripts/issue_show/components/app.vue
index e4679e7a05e..a9418dd0bb2 100644
--- a/app/assets/javascripts/issue_show/components/app.vue
+++ b/app/assets/javascripts/issue_show/components/app.vue
@@ -77,6 +77,7 @@ export default {
},
deleteIssuable() {
this.service.deleteIssuable()
+ .then(res => res.json())
.then((data) => {
// Stop the poll so we don't get 404's with the issue not existing
this.poll.stop();
diff --git a/app/assets/javascripts/issue_show/services/index.js b/app/assets/javascripts/issue_show/services/index.js
index f3ffa451bba..5da15882c25 100644
--- a/app/assets/javascripts/issue_show/services/index.js
+++ b/app/assets/javascripts/issue_show/services/index.js
@@ -20,12 +20,10 @@ export default class Service {
}
deleteIssuable() {
- return this.resource.delete()
- .then(res => res.json());
+ return this.resource.delete();
}
updateIssuable(data) {
- return this.resource.update(data)
- .then(res => res.json());
+ return this.resource.update(data);
}
}
diff --git a/spec/javascripts/issue_show/components/app_spec.js b/spec/javascripts/issue_show/components/app_spec.js
index 0af4d1e1f6a..1f46d836e1e 100644
--- a/spec/javascripts/issue_show/components/app_spec.js
+++ b/spec/javascripts/issue_show/components/app_spec.js
@@ -134,7 +134,9 @@ describe('Issuable output', () => {
spyOn(gl.utils, 'visitUrl');
spyOn(vm.service, 'deleteIssuable').and.callFake(() => new Promise((resolve) => {
resolve({
- path: '/test',
+ json() {
+ return { path: '/test' };
+ },
});
}));
@@ -154,7 +156,9 @@ describe('Issuable output', () => {
spyOn(vm.poll, 'stop');
spyOn(vm.service, 'deleteIssuable').and.callFake(() => new Promise((resolve) => {
resolve({
- path: '/test',
+ json() {
+ return { path: '/test' };
+ },
});
}));