diff options
author | Phil Hughes <me@iamphill.com> | 2018-01-26 10:14:44 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-01-29 09:06:57 +0000 |
commit | 797f29d184827312fb4c91a7a0c22863f0870c4b (patch) | |
tree | 32a1d390f40dc4308f1208215fc91824582cb62a /app/assets | |
parent | 9846332fcd8661dee7f15da4e0f177dc027254cb (diff) | |
download | gitlab-ce-797f29d184827312fb4c91a7a0c22863f0870c4b.tar.gz |
converted compare_autocomplete to axios
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/compare_autocomplete.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/app/assets/javascripts/compare_autocomplete.js b/app/assets/javascripts/compare_autocomplete.js index e633ef8a29e..0787400e862 100644 --- a/app/assets/javascripts/compare_autocomplete.js +++ b/app/assets/javascripts/compare_autocomplete.js @@ -1,4 +1,6 @@ /* 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, |