Commit 797f29d1 authored by Phil Hughes's avatar Phil Hughes

converted compare_autocomplete to axios

parent 9846332f
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, object-shorthand, comma-dangle, prefer-arrow-callback, no-else-return, newline-per-chained-call, wrap-iife, max-len */
import axios from './lib/utils/axios_utils';
import flash from './flash';
export default function initCompareAutocomplete() {
$('.js-compare-dropdown').each(function() {
......@@ -10,15 +12,14 @@ export default function initCompareAutocomplete() {
const $filterInput = $('input[type="search"]', $dropdownContainer);
$dropdown.glDropdown({
data: function(term, callback) {
return $.ajax({
url: $dropdown.data('refs-url'),
data: {
axios.get($dropdown.data('refsUrl'), {
params: {
ref: $dropdown.data('ref'),
search: term,
}
}).done(function(refs) {
return callback(refs);
});
},
}).then(({ data }) => {
callback(data);
}).catch(() => flash('Error fetching refs'));
},
selectable: true,
filterable: true,
......
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