Waiting for data from REST Query

I am designing a flow where I want to check user input against a REST API.

I compare the data coming back from the API to the data inserted by a user and want to either pop up an error message or if it is valid put the Data via another REST call to a database.

To achieve this, I currently add a delay of 5 Secs after using the get data logic block.

On slow connections 5 Secs is not enough and the check always fails because data is not yet available - for all other users the experience is bad because they have to wait 5 Secs even if data is available much earlier.

Is there a way to “wait” for the data coming back?

Thanks and Cheers to the AppGyvers …

You can e.g. create an App/Page variable dataIsAvailable with type true/false and change it to true when the request is complete.

Then on the flow that’s waiting, you can add an If condition checking the vale of dataIsAvailable. If true, continue your flow. If false, go to Delay Flow function (e.g. 25ms). After the Delay go back to the If condition.

So basically loop the Delay logic until you have the data you need ready.

Thanks, good hint. Will do it this way.

Cheers
Tobias