diff options
author | Phil Hughes <me@iamphill.com> | 2018-01-29 12:05:04 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-01-29 12:05:04 +0000 |
commit | cdb768d9eba6c38647f66de0ed3c10d9af8c0520 (patch) | |
tree | a83ab16979f4b7688b6a8995394e562488d92a5a /app/assets | |
parent | 33517d546e2f017de5911079a5a598e113aed6c9 (diff) | |
download | gitlab-ce-cdb768d9eba6c38647f66de0ed3c10d9af8c0520.tar.gz |
Converted gl_dropdown to axios
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index 64f258aed64..15df7a7f989 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -2,6 +2,7 @@ /* global fuzzaldrinPlus */ import _ from 'underscore'; import fuzzaldrinPlus from 'fuzzaldrin-plus'; +import axios from './lib/utils/axios_utils'; import { visitUrl } from './lib/utils/url_utility'; import { isObject } from './lib/utils/type_utility'; @@ -212,25 +213,17 @@ GitLabDropdownRemote = (function() { }; GitLabDropdownRemote.prototype.fetchData = function() { - return $.ajax({ - url: this.dataEndpoint, - dataType: this.options.dataType, - beforeSend: (function(_this) { - return function() { - if (_this.options.beforeSend) { - return _this.options.beforeSend(); - } - }; - })(this), - success: (function(_this) { - return function(data) { - if (_this.options.success) { - return _this.options.success(data); - } - }; - })(this) - }); - // Fetch the data through ajax if the data is a string + if (this.options.beforeSend) { + this.options.beforeSend(); + } + + // Fetch the data through ajax if the data is a string + return axios.get(this.dataEndpoint) + .then(({ data }) => { + if (this.options.success) { + return this.options.success(data); + } + }); }; return GitLabDropdownRemote; |