Axios

De Banane Atomic
Aller à la navigationAller à la recherche

Links

Client side

Html.svg
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
    const axios = window.axios;
</script>

Authentication

Js.svg
const instance = axios.create({
    baseURL: 'https://www.domain.net/api',
    auth: {
        username: 'xxx',
        password: 'yyy'
    }
});

Get

Js.svg
instance.get('/item?api-version=1')
    .then(function (response) {
        console.log(response);
    })
    .catch(function (error) {
        console.error(error);
    });