This package allows you to include the latest version of axios and use on a global level together with requirejs in your Magento2 setup straight out of the box
Use composer to install the module: composer require deadsimple/axioslibrary
Using this library is easy peasy, just include the axios script through requirejs, define Axios and use it wherever you like.
define([
'Axios'
], function (axios) {
'use strict';
// Make a request for a user with a given ID
axios.get('/user?ID=12345')
.then(function (response) {
// handle success
console.log(response);
})
.catch(function (error) {
// handle error
console.log(error);
})
.then(function () {
// always executed
});
})
This library loads: Axios v0.19.2