Create a file in the /src/
directory called index.js
Create an empty, exported function named fetchMovies()
.
Create a file in the /src/
directory called services.js
.
Inside of services.js
, create an exported function named fetchWithTimeout
that accepts a single argument named delay
.
Inside the body of fetchWithTimeout
return a promise that uses a timeout that simulates an HTTP delay. Use the following code:
return new Promise(resolve => setTimeout(resolve, delay));