diff options
author | Constance Okoghenun <cokoghenun@gitlab.com> | 2018-02-08 11:47:31 +0300 |
---|---|---|
committer | Constance Okoghenun <cokoghenun@gitlab.com> | 2018-02-08 11:47:31 +0300 |
commit | 36a301a3c9cbb788860b8c4b020b5095fd3a3363 (patch) | |
tree | 91feb10c1151f5b1801db5d2c03af3664b778cd0 /app/assets/javascripts/diff.js | |
parent | 6441612614fd5b89c7990010b9ba4734dbfe8ef1 (diff) |
Replaced use of $.get with axios.get and updated tests
Diffstat (limited to 'app/assets/javascripts/diff.js')
-rw-r--r-- | app/assets/javascripts/diff.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/assets/javascripts/diff.js b/app/assets/javascripts/diff.js index a162424b3cf..b26422ab725 100644 --- a/app/assets/javascripts/diff.js +++ b/app/assets/javascripts/diff.js @@ -1,3 +1,6 @@ +import axios from '~/lib/utils/axios_utils'; +import flash from '~/flash'; +import { __ } from '~/locale'; import { getLocationHash } from './lib/utils/url_utility'; import FilesCommentButton from './files_comment_button'; import SingleFileDiff from './single_file_diff'; @@ -69,7 +72,10 @@ export default class Diff { const view = file.data('view'); const params = { since, to, bottom, offset, unfold, view }; - $.get(link, params, response => $target.parent().replaceWith(response)); + // $.get(link, params, response => $target.parent().replaceWith(response)); + axios.get(link, { params }) + .then(({ data }) => $target.parent().replaceWith(data)) + .catch(() => flash(__('An error occurred while loading diff'))); } openAnchoredDiff(cb) { |