Display Alert box based on response from REST API call

I have an app that contains a Button and an Alert box. I would like the Alert to be hidden when the page first loads and when the value of a localStorage variable named "TEMP_ID" is empty (does not exist).

When the user clicks a button, it will execute a Resource Query (specifically its an REST API Call that returns JSON, of which there is a field in the JSON response called tempId). If that API Call comes back 200, then I want to set the localStorage variable TEMP_ID with the response's tempId value. And hopefully, since the Alert box's visibility is set to be hidden only when TEMP_ID is empty, now that TEMP_ID = tempId (from the response JSON), the Alert box displays.

I've tried many different things but can't seem to get it working, any ideas on how I can stitch this altogether?

Hey @Zac_Harvey! Definitely happy to help with this.

We can go step by step :slight_smile:

Here's a post that goes over hiding components dynamically. You can set a conditional value inside of the "Hidden" field of a component, so it'll be something like this. Hidden is set to true when there's no value.

Then, for the piece on setting the localStorage variable on a 200 return, we can add a success event handler to our query. We can also "Only run when" based on a certain condition. In my example, I'm only running the query when there's no error.

Let me know how this works for you and if not, any screenshots you have of your current setup would be great!