Converted usage_ping.js to use axios
also removed dependancy on jQuery because it is super simple & not required
This commit is contained in:
parent
ee1c471bad
commit
43f1088f5b
1 changed files with 11 additions and 10 deletions
|
@ -1,12 +1,13 @@
|
|||
export default function UsagePing() {
|
||||
const usageDataUrl = $('.usage-data').data('endpoint');
|
||||
import axios from '../../../lib/utils/axios_utils';
|
||||
import { __ } from '../../../locale';
|
||||
import flash from '../../../flash';
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: usageDataUrl,
|
||||
dataType: 'html',
|
||||
success(html) {
|
||||
$('.usage-data').html(html);
|
||||
},
|
||||
});
|
||||
export default function UsagePing() {
|
||||
const el = document.querySelector('.usage-data');
|
||||
|
||||
axios.get(el.dataset.endpoint, {
|
||||
responseType: 'text',
|
||||
}).then(({ data }) => {
|
||||
el.innerHTML = data;
|
||||
}).catch(() => flash(__('Error fetching usage ping data.')));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue