API calls from App and Config

Hello,
I am moving an app from UI Kit 1 to UI kit and I’m stuck with its behaviour.
Basically it is a macro with custom config. In the config there is a Select where the user picks a space from a list (list created using a API call), then this is passed on for processing.
The macro itself use the space in the config to create a page in that space (which requires its own api call).

Now, according to the Forge documentation I can have only 1 resolver/handler per macro, but I need to make different calls from the Config and the App itself.
I tried creating export functions in the resolver folder and calling them from the frontend but no luck.
What is the right approach?
Should I invoke the same resolver and then branch depending on whether the call if from the App or the Config?
Thanks!

Hey @MatteoGubelliniSoftC

Sorry it’s taken a few days to reply, looking at your question:

You can only have 1 resolver per macro, but you can have multiple resolver functions (see weather-gadget/src/resolvers/index.js at main · meliaecodes/weather-gadget · GitHub for an example).

Would this help solve your problem?

Let me know how you go.
Cheers!
Mel

1 Like

Oh!
I ended up having a single resolver branching into different functions and it worked fine.
Your approach is much tidier, will do next time!
Thanks!
Matteo

That does work too!
Glad you got it working.
Cheers
Mel