diff options
author | Phil Hughes <me@iamphill.com> | 2018-02-02 11:23:42 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-02-05 09:41:00 +0000 |
commit | c7b9bba5b882b0ad0f8aef4010ae92ac54c902ed (patch) | |
tree | 6c3bcd6efc1605c7ecdc7234aca83e6a3eebb3d2 /app/assets/javascripts/shortcuts.js | |
parent | 015e15f4e8a55782e7ab9acf3ffee928a02313ec (diff) | |
download | gitlab-ce-c7b9bba5b882b0ad0f8aef4010ae92ac54c902ed.tar.gz |
Converted shortcuts.js to use axios
Diffstat (limited to 'app/assets/javascripts/shortcuts.js')
-rw-r--r-- | app/assets/javascripts/shortcuts.js | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/app/assets/javascripts/shortcuts.js b/app/assets/javascripts/shortcuts.js index cd5ab53eace..c5dddd001bb 100644 --- a/app/assets/javascripts/shortcuts.js +++ b/app/assets/javascripts/shortcuts.js @@ -1,5 +1,6 @@ import Cookies from 'js-cookie'; import Mousetrap from 'mousetrap'; +import axios from './lib/utils/axios_utils'; import { refreshCurrentPage, visitUrl } from './lib/utils/url_utility'; import findAndFollowLink from './shortcuts_dashboard_navigation'; @@ -85,21 +86,21 @@ export default class Shortcuts { $modal.modal('toggle'); } - $.ajax({ - url: gon.shortcuts_path, - dataType: 'script', - success() { - if (location && location.length > 0) { - const results = []; - for (let i = 0, len = location.length; i < len; i += 1) { - results.push($(location[i]).show()); - } - return results; + return axios.get(gon.shortcuts_path, { + responseType: 'text', + }).then(({ data }) => { + $.globalEval(data); + + if (location && location.length > 0) { + const results = []; + for (let i = 0, len = location.length; i < len; i += 1) { + results.push($(location[i]).show()); } + return results; + } - $('.hidden-shortcut').show(); - return $('.js-more-help-button').remove(); - }, + $('.hidden-shortcut').show(); + return $('.js-more-help-button').remove(); }); } |