summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-01-29 12:10:07 +0000
committerPhil Hughes <me@iamphill.com>2018-01-29 12:10:07 +0000
commita491bcc2b161b7c14e48e909be249170136a4d39 (patch)
treec4beac2248e5d60c75589b1731437c249e7da8e9
parentcdb768d9eba6c38647f66de0ed3c10d9af8c0520 (diff)
downloadgitlab-ce-a491bcc2b161b7c14e48e909be249170136a4d39.tar.gz
Converted graphs_show to axios
-rw-r--r--app/assets/javascripts/graphs/graphs_show.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/app/assets/javascripts/graphs/graphs_show.js b/app/assets/javascripts/graphs/graphs_show.js
index 36bad6db3e1..b670e907a5c 100644
--- a/app/assets/javascripts/graphs/graphs_show.js
+++ b/app/assets/javascripts/graphs/graphs_show.js
@@ -1,11 +1,13 @@
+import flash from '../flash';
+import { __ } from '../locale';
+import axios from '../lib/utils/axios_utils';
import ContributorsStatGraph from './stat_graph_contributors';
document.addEventListener('DOMContentLoaded', () => {
- $.ajax({
- type: 'GET',
- url: document.querySelector('.js-graphs-show').dataset.projectGraphPath,
- dataType: 'json',
- success(data) {
+ const url = document.querySelector('.js-graphs-show').dataset.projectGraphPath;
+
+ axios.get(url)
+ .then(({ data }) => {
const graph = new ContributorsStatGraph();
graph.init(data);
@@ -16,6 +18,6 @@ document.addEventListener('DOMContentLoaded', () => {
$('.stat-graph').fadeIn();
$('.loading-graph').hide();
- },
- });
+ })
+ .catch(() => flash(__('Error fetching contributors data.')));
});