Commit 9709b5ed authored by Clement Ho's avatar Clement Ho

Replace $.ajax in activity calendar with axios

parent 560c93e6
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