diff options
author | Phil Hughes <me@iamphill.com> | 2018-02-02 15:36:51 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-02-05 12:41:44 +0300 |
commit | 004158066de3442d63293b947c2f705032903342 (patch) | |
tree | eedfc49aae8f33714b08b3587a15b4a3b11973ec /app/assets | |
parent | 8d83e517a98688d453baffed17dc000b6b23ef23 (diff) |
fixed failing karma specs caused by TaskList
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/task_list.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/assets/javascripts/task_list.js b/app/assets/javascripts/task_list.js index c35a702ecfc..129a551cbcd 100644 --- a/app/assets/javascripts/task_list.js +++ b/app/assets/javascripts/task_list.js @@ -8,11 +8,11 @@ export default class TaskList { this.dataType = options.dataType; this.fieldName = options.fieldName; this.onSuccess = options.onSuccess || (() => {}); - this.onError = function showFlash(response) { + this.onError = function showFlash(e) { let errorMessages = ''; - if (response.responseJSON) { - errorMessages = response.responseJSON.errors.join(' '); + if (e.response.data && typeof e.response.data === 'object') { + errorMessages = e.response.data.errors.join(' '); } return new Flash(errorMessages || 'Update failed', 'alert'); @@ -42,6 +42,6 @@ export default class TaskList { return axios.patch($target.data('update-url') || $('form.js-issuable-update').attr('action'), patchData) .then(({ data }) => this.onSuccess(data)) - .catch(() => this.onError()); + .catch(err => this.onError(err)); } } |