piotrwitek / typesafe-actions

Typesafe utilities for "action-creators" in Redux / Flux Architecture
https://codesandbox.io/s/github/piotrwitek/typesafe-actions/tree/master/codesandbox
MIT License
2.41k stars 98 forks source link

Fix redux-saga example in the docs #184

Closed piotrwitek closed 5 years ago

piotrwitek commented 5 years ago

Description

Redux saga example in the docs doesn't work because of a missing line https://github.com/piotrwitek/typesafe-actions#with-redux-saga-sagas

Suggested solution(s)

function* addTodoSaga(action: ReturnType<typeof fetchTodosAsync.request>): Generator {
  try { // <= this line is missing
    const response: Todo[] = yield call(todosApi.getAll, action.payload);

    yield put(fetchTodosAsync.success(response));
  } catch (err) {
    yield put(fetchTodosAsync.failure(err));
  }
}