Moved json parsing out of service

[ci skip]
This commit is contained in:
Phil Hughes 2017-05-12 13:04:36 +01:00
parent 3d553954d4
commit 478812543c
3 changed files with 9 additions and 6 deletions

View file

@ -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();

View file

@ -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);
}
}

View file

@ -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' };
},
});
}));