fixed unhandled promise rejection
This commit is contained in:
parent
10cc5d1a80
commit
39fa83553c
|
@ -75,12 +75,12 @@ Sidebar.prototype.toggleTodo = function(e) {
|
||||||
|
|
||||||
$('.js-issuable-todo').disable().addClass('is-loading');
|
$('.js-issuable-todo').disable().addClass('is-loading');
|
||||||
|
|
||||||
return axios[ajaxType](url, {
|
axios[ajaxType](url, {
|
||||||
issuable_id: $this.data('issuable-id'),
|
issuable_id: $this.data('issuable-id'),
|
||||||
issuable_type: $this.data('issuable-type'),
|
issuable_type: $this.data('issuable-type'),
|
||||||
}).then(({ data }) => {
|
}).then(({ data }) => {
|
||||||
this.todoUpdateDone(data);
|
this.todoUpdateDone(data);
|
||||||
});
|
}).catch(() => flash(`There was an error ${ajaxType === 'post' ? 'adding a' : 'deleting the'} todo.`));
|
||||||
};
|
};
|
||||||
|
|
||||||
Sidebar.prototype.todoUpdateDone = function(data) {
|
Sidebar.prototype.todoUpdateDone = function(data) {
|
||||||
|
|
|
@ -74,8 +74,7 @@ import Sidebar from '~/right_sidebar';
|
||||||
|
|
||||||
it('should broadcast todo:toggle event when add todo clicked', function(done) {
|
it('should broadcast todo:toggle event when add todo clicked', function(done) {
|
||||||
var todos = getJSONFixture('todos/todos.json');
|
var todos = getJSONFixture('todos/todos.json');
|
||||||
spyOn(axios, 'get').and.callThrough();
|
mock.onPost(/(.*)\/todos$/).reply(200, todos);
|
||||||
mock.onAny(`${gl.TEST_HOST}/frontend-fixtures/issues-project/todos`).reply(200, todos);
|
|
||||||
|
|
||||||
var todoToggleSpy = spyOnEvent(document, 'todo:toggle');
|
var todoToggleSpy = spyOnEvent(document, 'todo:toggle');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue