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-15 11:33:31 +0100
commit478812543ce82dbfc7a408706aa94ab870443735 (patch)
treef9cff2e05106d908e7d9056bff547275352c85d9
parent3d553954d4bd93f0cde41e2a42d4c73443c5e2db (diff)
downloadgitlab-ce-478812543ce82dbfc7a408706aa94ab870443735.tar.gz
Moved json parsing out of service
[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' };
+ },
});
}));