Apr 16, 2024 05:41 AM
I added a button to a table that forms a task when the button is clicked.
The task is an async call to a REST API using Javascript's fetch. I'd like to be able to display the state of the operation, including when its completed.
The code:
// make the REST API with an async function
const response = await updateLicense(config.access_token, employeeNumber, licenseNumber);
// dispay the results of the processing
output.text(response)
Unfortunately, the code doesn't wait for the updateLicense function to complete. Any ideas?
Solved! Go to Solution.
Apr 19, 2024 10:03 AM
The script works correctly, but I forgot that the webhook is async, so it returns a unique identifier early, rather than the full results when it completed.
Apr 16, 2024 08:34 AM
What does the rest of the script look like, including the updateLicense() function? Is it an async function where you await the fetch?
Apr 19, 2024 10:03 AM
The script works correctly, but I forgot that the webhook is async, so it returns a unique identifier early, rather than the full results when it completed.