Commit ab8449e6 authored by Fatih Acet's avatar Fatih Acet
Browse files

Merge branch 'axios-calendar' into 'master'

Replace $.ajax in activity calendar with axios

See merge request gitlab-org/gitlab-ce!16839
import _ from 'underscore'; import _ from 'underscore';
import { scaleLinear, scaleThreshold } from 'd3-scale'; import { scaleLinear, scaleThreshold } from 'd3-scale';
import { select } from 'd3-selection'; import { select } from 'd3-selection';
import { getDayName, getDayDifference } from '../lib/utils/datetime_utility'; import { getDayName, getDayDifference } from '~/lib/utils/datetime_utility';
import axios from '~/lib/utils/axios_utils';
import flash from '~/flash';
import { __ } from '~/locale';
const d3 = { select, scaleLinear, scaleThreshold }; const d3 = { select, scaleLinear, scaleThreshold };
...@@ -221,14 +224,16 @@ export default class ActivityCalendar { ...@@ -221,14 +224,16 @@ export default class ActivityCalendar {
this.currentSelectedDate.getDate(), this.currentSelectedDate.getDate(),
].join('-'); ].join('-');
$.ajax({ $('.user-calendar-activities').html(LOADING_HTML);
url: this.calendarActivitiesPath,
data: { date }, axios.get(this.calendarActivitiesPath, {
cache: false, params: {
dataType: 'html', date,
beforeSend: () => $('.user-calendar-activities').html(LOADING_HTML), },
success: data => $('.user-calendar-activities').html(data), responseType: 'text',
}); })
.then(({ data }) => $('.user-calendar-activities').html(data))
.catch(() => flash(__('An error occurred while retrieving calendar activity')));
} else { } else {
this.currentSelectedDate = ''; this.currentSelectedDate = '';
$('.user-calendar-activities').html(''); $('.user-calendar-activities').html('');
......
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