Cannot read property '$session' of undefined


#1
  ON_REQUEST() {
        async function getsapdata() {

            let params = {
                minimumAge: 0,
                maximumAge: 0,
                price: 100,
                keywords: 'categorye'
            };

            axios.defaults.baseURL = "https://local.test";
            let res = await axios.get("/events", params);
            this.$session.$data.sorties = res.data;

        }
        getsapdata();
    },

Cannot read property ‘$session’ of undefined


#2

I would recommend putting the getsapdata() not in a handler function.

this is in your case the context of the getsapdata function, not the required jovo context.


#3

when i try outside

Message:
this.getsapdata is not a function

Stack:
TypeError: this.getsapdata is not a function


#4

where set function, can be acceded by all handler function ?