I am trying to update a Text Widget in a Modal from the response of an API call and cannot figure out what I am missing.
Here is what the screen looks like:
When I click the Status button, the API is called, and I see the right responses on the console log, but, the Text Widget is not showing the response data. When I click the button, the Text Widget goes gray while the API call is running and then returns back the default string I have set in JSObject1.status
.
The button has an onClick event:
{{JSObject1.getWorldStatus()}}
The Text Widget has Text:
{{JSObject1.status}}
The JSObject1 code is the following:
export default {
status: "No data to display...",
getWorldStatus: async () => {
console.log(JSObject1.status);
JSObject1.status = "...";
console.log(JSObject1.status);
WorldStatus.run();
JSObject1.status = WorldStatus.data;
console.log(JSObject1.status);
return JSObject1.status;
}
}
My console.log is this:
No data to display...
...
Server Status: not running.
I am expecting Server Status: not running.
to be in the Text Widget but instead I see the original string No data to display...
.
What am I missing?