I have a front end that lists documents, when a user clicks to download it will call the API and request a URL with a Amazon Storage SAS token. This happens async, so may take a short moment. Once the URL is returned how can I then trigger the download?
I cant pre fetch the URL as it has a SAS token that expires after a period of time, the user may easily wait past that period of time before fetching the document and would get a access denied error.
I cant use a anchor tag as the URL is not known at the time of click. I could create a new button that says download, but now the user presses download twice, for one file. Is there a way to trigger a download? Perhaps in useEffect ?