From 478812543ce82dbfc7a408706aa94ab870443735 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 12 May 2017 13:04:36 +0100 Subject: [PATCH] Moved json parsing out of service [ci skip] --- app/assets/javascripts/issue_show/components/app.vue | 1 + app/assets/javascripts/issue_show/services/index.js | 6 ++---- spec/javascripts/issue_show/components/app_spec.js | 8 ++++++-- 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' }; + }, }); }));