Slide 18
Slide 18 text
struct FetchTodo: Action {
typealias Payload = [Todo]
func invoke(dispatcher: Dispatcher) {
Session.sendRequest(FetchTodoRequest()) { result in
switch result {
case .Success(let todos):
dispatcher.dispatch(self, result: Result(value: todos))
case .Failure(let error):
dispatcher.dispatch(self, result: Result(error: error))
}
}
}
}
Action