Commit d58ff943 authored by Phil Hughes's avatar Phil Hughes

Converted milestone.js to axios

parent f165bda4
import Flash from './flash'; import axios from './lib/utils/axios_utils';
import flash from './flash';
export default class Milestone { export default class Milestone {
constructor() { constructor() {
...@@ -33,15 +34,12 @@ export default class Milestone { ...@@ -33,15 +34,12 @@ export default class Milestone {
const tabElId = $target.attr('href'); const tabElId = $target.attr('href');
if (endpoint && !$target.hasClass('is-loaded')) { if (endpoint && !$target.hasClass('is-loaded')) {
$.ajax({ axios.get(endpoint)
url: endpoint, .then(({ data }) => {
dataType: 'JSON',
})
.fail(() => new Flash('Error loading milestone tab'))
.done((data) => {
$(tabElId).html(data.html); $(tabElId).html(data.html);
$target.addClass('is-loaded'); $target.addClass('is-loaded');
}); })
.catch(() => flash('Error loading milestone tab'));
} }
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment