diff options
author | Phil Hughes <me@iamphill.com> | 2018-01-31 13:14:55 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-01-31 13:14:55 +0300 |
commit | 641f1d2c4b210026fd40c4c3d3acc1bd41dc9adc (patch) | |
tree | a8f1be947c139f6ed16e7e52b4e9d01db7845b5d /app/assets/javascripts/lib | |
parent | ae401d03d3261cda379ccd3367a877fb095c4e59 (diff) |
Converted common_utils to axios
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index 03918762842..0fcf8b410af 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -1,3 +1,4 @@ +import axios from './axios_utils'; import { getLocationHash } from './url_utility'; export const getPagePath = (index = 0) => $('body').attr('data-page').split(':')[index]; @@ -27,17 +28,14 @@ export const isInIssuePage = () => { return page === 'issues' && action === 'show'; }; -export const ajaxGet = url => $.ajax({ - type: 'GET', - url, - dataType: 'script', +export const ajaxGet = url => axios.get(url, { + params: { format: 'js' }, + responseType: 'text', +}).then(({ data }) => { + $.globalEval(data); }); -export const ajaxPost = (url, data) => $.ajax({ - type: 'POST', - url, - data, -}); +export const ajaxPost = (url, data) => axios.post(url, data); export const rstrip = (val) => { if (val) { |