Converted milestone.js to axios
This commit is contained in:
parent
f165bda4ae
commit
d58ff9433d
|
@ -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'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue