mirror of
https://github.com/tenrok/axios.git
synced 2026-05-18 12:39:44 +03:00
1.3 KiB
1.3 KiB
Upgrade Guide
0.5.x -> 0.6.0
The 0.6.0 release contains mostly bug fixes, but there are a couple things to be aware of when upgrading.
ES6 Promise Polyfill
Up until the 0.6.0 release ES6 Promise was being polyfilled using es6-promise. With this release, the polyfill has been removed, and you will need to supply the it yourself if your environment needs it.
require('es6-promise').polyfill();
var axios = require('axios');
This will polyfill the global environment, and only needs to be done once.
axios.success/axios.error
The success, and error aliases were deprectated in 0.4.0. As of this release they have been removed entirely. Instead please use axios.then, and axios.catch respectively.
axios.get('some/url')
.then(function (res) {
/* ... */
})
.catch(function (err) {
/* ... */
});
UMD
Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build.
// AMD
require(['bower_components/axios/dist/axios'], function (axios) {
/* ... */
});
// CommonJS
var axios = require('axios/dist/axios');