diff options
author | Phil Hughes <me@iamphill.com> | 2018-02-01 14:18:01 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-02-01 14:18:01 +0300 |
commit | 43f1088f5b086b95a3d5cdd90a33d26bb483cba5 (patch) | |
tree | 93d503d6f317a0aae0b8d557315db1883f7369ce /app/assets/javascripts/pages/admin/cohorts | |
parent | ee1c471bad95cb640ea63393954825dd5a68a9e2 (diff) |
Converted usage_ping.js to use axios
also removed dependancy on jQuery because it is super simple & not required
Diffstat (limited to 'app/assets/javascripts/pages/admin/cohorts')
-rw-r--r-- | app/assets/javascripts/pages/admin/cohorts/usage_ping.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/app/assets/javascripts/pages/admin/cohorts/usage_ping.js b/app/assets/javascripts/pages/admin/cohorts/usage_ping.js index 2389056bd02..914a9661c27 100644 --- a/app/assets/javascripts/pages/admin/cohorts/usage_ping.js +++ b/app/assets/javascripts/pages/admin/cohorts/usage_ping.js @@ -1,12 +1,13 @@ +import axios from '../../../lib/utils/axios_utils'; +import { __ } from '../../../locale'; +import flash from '../../../flash'; + export default function UsagePing() { - const usageDataUrl = $('.usage-data').data('endpoint'); + const el = document.querySelector('.usage-data'); - $.ajax({ - type: 'GET', - url: usageDataUrl, - dataType: 'html', - success(html) { - $('.usage-data').html(html); - }, - }); + axios.get(el.dataset.endpoint, { + responseType: 'text', + }).then(({ data }) => { + el.innerHTML = data; + }).catch(() => flash(__('Error fetching usage ping data.'))); } |