Replace $.ajax in preview markdown with axios
This commit is contained in:
parent
3cb7b472cd
commit
11df0c231f
|
@ -7,6 +7,10 @@
|
||||||
// more than `x` users are referenced.
|
// more than `x` users are referenced.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import axios from '~/lib/utils/axios_utils';
|
||||||
|
import flash from '~/flash';
|
||||||
|
import { __ } from '~/locale';
|
||||||
|
|
||||||
var lastTextareaPreviewed;
|
var lastTextareaPreviewed;
|
||||||
var lastTextareaHeight = null;
|
var lastTextareaHeight = null;
|
||||||
var markdownPreview;
|
var markdownPreview;
|
||||||
|
@ -62,21 +66,17 @@ MarkdownPreview.prototype.fetchMarkdownPreview = function (text, url, success) {
|
||||||
success(this.ajaxCache.response);
|
success(this.ajaxCache.response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$.ajax({
|
axios.post(url, {
|
||||||
type: 'POST',
|
text,
|
||||||
url: url,
|
})
|
||||||
data: {
|
.then(({ data }) => {
|
||||||
text: text
|
this.ajaxCache = {
|
||||||
},
|
text: text,
|
||||||
dataType: 'json',
|
response: data,
|
||||||
success: (function (response) {
|
};
|
||||||
this.ajaxCache = {
|
success(data);
|
||||||
text: text,
|
})
|
||||||
response: response
|
.catch(() => flash(__('An error occurred while fetching markdown preview')));
|
||||||
};
|
|
||||||
success(response);
|
|
||||||
}).bind(this)
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MarkdownPreview.prototype.hideReferencedUsers = function ($form) {
|
MarkdownPreview.prototype.hideReferencedUsers = function ($form) {
|
||||||
|
|
Loading…
Reference in New Issue