fchiusolo / RandomJokes

App that displays random jokes about someone in the user's contacts list
2 stars 0 forks source link

Refactor JokeInteractor #2

Closed fchiusolo closed 5 years ago

fchiusolo commented 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:

contactsRepository.random()
        .then { jokesRepository.fetch(person: $0.person) }
        .then { presenter.update(joke: $0) }
        .catch { presenter.update(error: $0) }