Friday, December 2, 2022

Promise with timeout

When you use await, it will wait until the Promise is either resolved or rejected. But sometimes API requests we make don’t get any response from the server.

You can use AbortController to abort one or more Web requests. The second way to solve this is to create a promise with a timeout.