Commit b8c43a73 authored by Clement Ho's avatar Clement Ho

Replace $.ajax in find file with axios

parent 560c93e6
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, quotes, consistent-return, one-var, one-var-declaration-per-line, no-cond-assign, max-len, object-shorthand, no-param-reassign, comma-dangle, prefer-template, no-unused-vars, no-return-assign */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, quotes, consistent-return, one-var, one-var-declaration-per-line, no-cond-assign, max-len, object-shorthand, no-param-reassign, comma-dangle, prefer-template, no-unused-vars, no-return-assign */
import fuzzaldrinPlus from 'fuzzaldrin-plus'; import fuzzaldrinPlus from 'fuzzaldrin-plus';
import axios from '~/lib/utils/axios_utils';
import flash from '~/flash';
import { __ } from '~/locale';
// highlight text(awefwbwgtc -> <b>a</b>wefw<b>b</b>wgt<b>c</b> ) // highlight text(awefwbwgtc -> <b>a</b>wefw<b>b</b>wgt<b>c</b> )
const highlighter = function(element, text, matches) { const highlighter = function(element, text, matches) {
...@@ -72,19 +75,14 @@ export default class ProjectFindFile { ...@@ -72,19 +75,14 @@ export default class ProjectFindFile {
// files pathes load // files pathes load
load(url) { load(url) {
return $.ajax({ axios.get(url)
url: url, .then(({ data }) => {
method: "get", this.element.find('.loading').hide();
dataType: "json", this.filePaths = data;
success: (function(_this) { this.findFile();
return function(data) { this.element.find('.files-slider tr.tree-item').eq(0).addClass('selected').focus();
_this.element.find(".loading").hide(); })
_this.filePaths = data; .catch(() => flash(__('An error occurred while loading filenames')));
_this.findFile();
return _this.element.find(".files-slider tr.tree-item").eq(0).addClass("selected").focus();
};
})(this)
});
} }
// render result // render result
......
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