Open docapi opened 1 year ago
Same problem
Are you passing the function directly in the Astro config?
That's not possible as far as I'm aware, but I haven't tried to be honest. I'll find some time the next days to play around with this. Probably we need to build some sort of runtime hook system to work with those handlers. I'll think about this.
If you have functions in your cookie configuration file, JSON.stringify will omit them. So maybe you have to add a special convert job which skips the JSON.stringify-part for functions.
Or do you see an other way to inject the callbacks?
Sorry for the long silence ... my current idea to solve this, is to load the config from the window object, which you could then define in your main Layout or in a component.
This would remove the configuration from the Astro config into plain JS / TS code, which then allows you to work with callbacks as expected.
IMO, this would be the cleanest solution, do you think this approach would solve your issues?
The config doesn't accept functions, so it's not possible to define the callback "onFirstAction", "onAccept" and "onChange".
e.g.