How to access data/context in custom code

I haven’t been able to find any information on your documentation for how to make use of custom code to modify behaviour of weweb defined plugins/data/etc.

My immediate use case is that I am looking to add an interceptor to axios (if my server returns 401, go through re-auth) but I would also love any general information available.

1 Like

Hi peter!

I think the most simple solution to do what you want would be to add an “On app load” workflow with a “Custom Javascript” action, and add your interceptor here.

Would this work for you ?

That would be perfect!

However, pardon my ignorance if the answer is obvious, I haven’t been able to found where to setup an on-app-load WF.

The only ones I’m aware of are on-page-load workflows that are all defined on a page by page basis. As far as I can tell the global workflows are just reusable definitions not something that has a global trigger?

You can find on app load workflows here :

These workflows will be executed on any page load.

:pray: :pray: :pray: :pray: :pray:

Phenomenal

& for my specific case, {this} is undefined but {axios} is in the namespace, so it works but idk how haha – just hoping it doesn’t change in the future :slight_smile:

axios is a global variable and it will stay this way :slight_smile:
It’s so users & developers can use axios without any constraint

2 Likes