Need setup axios and retrieve data


#1

Hi
i have make npm install axios

on top of app.js

const axios = require("axios");

and after

 async ON_REQUEST() {
        axios.defaults.baseURL = "https://api.test";
        axios("/events", {
                params: {
                    start: maintenant,
                    end: maintenant,
                    price: 100,
                    keywords: 'familly'
                }
            })
            .then(res => {
                this.$data.sorties = res.data;
            });
    },

it return undefined (so i try in stand alone script, and it’s ok )


closed #2

#3

I heard this got fixed. closing now


#4

Add await right before axios('/...')

Here’s a tutorial for asynchronous API calls in Jovo apps.