Skip to main content

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?

What does the rest of the script look like, including the updateLicense() function? Is it an async function where you await the fetch?


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.