Where to make globale function?


#1

hi
i try to make a global function can be launch from any handler.

so I start to know how to store data
but have any issue , it ’ s seems not work if outside handler

after setHandler

and call method from handler fail too


#2

The this context only works inside a handler intent.

And the function would need to be called without this.


#3

just try again without success


#4

@Sylvain_P You need to use await getsapdata().


#5

i dont get what you mean.
but I try without axios ( TypeError: Converting circular structure to JSON ),

and is ok if I follow this


#6

You’re using an async function inside of an async handler function (ON_REQUEST). If you don’t use this.$session.$data.pomme = await getsapdata();, the handler code won’t wait until your axios call is finished.