diff options
author | Phil Hughes <me@iamphill.com> | 2018-01-31 09:29:29 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-01-31 09:29:29 +0000 |
commit | d58ff9433db2e737329d7aea436d086a133bdfe0 (patch) | |
tree | 54b58cfff946503e3609021bb361807af321a36b /app/assets/javascripts/milestone.js | |
parent | f165bda4ae2a92528e6f4da25825c1e441094c54 (diff) | |
download | gitlab-ce-d58ff9433db2e737329d7aea436d086a133bdfe0.tar.gz |
Converted milestone.js to axios
Diffstat (limited to 'app/assets/javascripts/milestone.js')
-rw-r--r-- | app/assets/javascripts/milestone.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/app/assets/javascripts/milestone.js b/app/assets/javascripts/milestone.js index dd6c6b854bc..b1d74250dfd 100644 --- a/app/assets/javascripts/milestone.js +++ b/app/assets/javascripts/milestone.js @@ -1,4 +1,5 @@ -import Flash from './flash'; +import axios from './lib/utils/axios_utils'; +import flash from './flash'; export default class Milestone { constructor() { @@ -33,15 +34,12 @@ export default class Milestone { const tabElId = $target.attr('href'); if (endpoint && !$target.hasClass('is-loaded')) { - $.ajax({ - url: endpoint, - dataType: 'JSON', - }) - .fail(() => new Flash('Error loading milestone tab')) - .done((data) => { - $(tabElId).html(data.html); - $target.addClass('is-loaded'); - }); + axios.get(endpoint) + .then(({ data }) => { + $(tabElId).html(data.html); + $target.addClass('is-loaded'); + }) + .catch(() => flash('Error loading milestone tab')); } } } |