Converted usage_ping.js to use axios

also removed dependancy on jQuery because it is super simple & not required
This commit is contained in:
Phil Hughes 2018-02-01 11:18:01 +00:00
parent ee1c471bad
commit 43f1088f5b
No known key found for this signature in database
GPG key ID: 32245528C52E0F9F

View file

@ -1,12 +1,13 @@
export default function UsagePing() { import axios from '../../../lib/utils/axios_utils';
const usageDataUrl = $('.usage-data').data('endpoint'); import { __ } from '../../../locale';
import flash from '../../../flash';
$.ajax({ export default function UsagePing() {
type: 'GET', const el = document.querySelector('.usage-data');
url: usageDataUrl,
dataType: 'html', axios.get(el.dataset.endpoint, {
success(html) { responseType: 'text',
$('.usage-data').html(html); }).then(({ data }) => {
}, el.innerHTML = data;
}); }).catch(() => flash(__('Error fetching usage ping data.')));
} }