We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

Beatso's avatar
Beatso
Explorer | Level 4
5 years ago

Create sharing link after file upload

I'm using the Javascript SDK, and code uploads some files, creating their parent folders, then creates a sharing link of one of the parent folders. But because javascript is asyncronous, the files ha...
  • Greg-DB's avatar
    5 years ago

    The calls in the JavaScript SDK are asynchronous as you mentioned, so if you have additional operation(s) to perform that depend on the result of an earlier call, you should only perform the additional operation(s) once the necessary earlier ones have completed. You can do so by only triggering the later operations once you get the response back from the earlier one. 

     

    With the Dropbox JavaScript SDK, you can run code from inside the response function for an API call. So, in this example for instance, that would mean you trigger the next API call from inside the "function(response)" set in the ".then", like how that example appends a message to an element on the page.