d10sfan
d10sfan7mo ago

How can I set the state of an app inside a fetch script?

I'm trying to use a fetch script, and then with the result store it in the state. How can I store it and then use it later?
6 Replies
Tiago Serafim
Tiago Serafim7mo ago
In a REST script you cannot import libraries, so ideally you'd use a flow where there's your current fetch script and another step where you save it to state. The state is then tied to this specific flow path.
d10sfan
d10sfan7mo ago
ah ok thanks Is there a way to set a state of the app in use? I'd like to do an API call that gets a token, or receives the error from it, and then make it available to the app for future use.
d10sfan
d10sfan7mo ago
I see https://www.windmill.dev/docs/apps/app-runnable-panel#state but that does not seem to work inside a flow
Runnable Editor | Windmill
The strength of Windmill's app editor is the ability to connect everything together:
d10sfan
d10sfan7mo ago
Since those are front-end scripts, and not flows
Tiago Serafim
Tiago Serafim7mo ago
If you mean in a App, you have to do a background runnable and then another background runnable that runs on the frontend to use that variable In that frontend runnable, you can set the value to the App state
d10sfan
d10sfan7mo ago
ah ok thanks That did the trick, thanks for the help!