Closed fchiusolo closed 5 years ago
Refactor the function fetch so that the two sequential asynchronous calls to the contacts repository and to the jokes repository are handled functionally. The expected result should be something like:
fetch
contactsRepository.random() .then { jokesRepository.fetch(person: $0.person) } .then { presenter.update(joke: $0) } .catch { presenter.update(error: $0) }
Refactor the function
fetch
so that the two sequential asynchronous calls to the contacts repository and to the jokes repository are handled functionally. The expected result should be something like: