mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-31 01:35:15 +02:00
Replaces JQuery ajax requests with Axios requests
This commit is contained in:
parent
c295371f4d
commit
4fe9676318
@ -55,6 +55,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"app-module-path": "^1.0.3",
|
"app-module-path": "^1.0.3",
|
||||||
|
"axios": "^0.18.0",
|
||||||
"chart.js": "^2.4.0",
|
"chart.js": "^2.4.0",
|
||||||
"classnames": "^2.2.5",
|
"classnames": "^2.2.5",
|
||||||
"draft-js": "^0.10.0",
|
"draft-js": "^0.10.0",
|
||||||
@ -65,6 +66,7 @@
|
|||||||
"localStorage": "^1.0.3",
|
"localStorage": "^1.0.3",
|
||||||
"lodash": "^3.10.0",
|
"lodash": "^3.10.0",
|
||||||
"messageformat": "^0.2.2",
|
"messageformat": "^0.2.2",
|
||||||
|
"qs": "^6.5.2",
|
||||||
"react": "^15.4.2",
|
"react": "^15.4.2",
|
||||||
"react-chartjs-2": "^2.0.0",
|
"react-chartjs-2": "^2.0.0",
|
||||||
"react-document-title": "^1.0.2",
|
"react-document-title": "^1.0.2",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const $ = require('jquery');
|
const axios = require('axios');
|
||||||
|
const qs = require('qs');
|
||||||
|
|
||||||
const APIUtils = {
|
const APIUtils = {
|
||||||
|
|
||||||
@ -11,21 +12,14 @@ const APIUtils = {
|
|||||||
data: data
|
data: data
|
||||||
};
|
};
|
||||||
|
|
||||||
if(dataAsForm) {
|
if(!dataAsForm){
|
||||||
options = {
|
options.headers = {'content-type': 'application/x-www-form-urlencoded'},
|
||||||
url: path,
|
options.data = qs.stringify(options.data);
|
||||||
type: method,
|
|
||||||
data: data,
|
|
||||||
processData: false,
|
|
||||||
contentType: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax(options)
|
axios(options)
|
||||||
.done(resolve)
|
.then((result) => resolve(result.data))
|
||||||
.fail((jqXHR, textStatus) => {
|
.catch(() => reject());
|
||||||
reject(textStatus);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user