Exemple #1
0
function * loadBooksSaga () {
  const uid = yield select(state => state.getIn(['user', 'uid']))

  try {
    const list = yield call(
      rsf.database.read,
      `books/${uid}`
    )
    yield put(loadBooksSuccess(bookTransformer.parseList(list)))
  } catch (error) {
    yield put(loadBooksFailure(error))
    yield put(notifyError('Error while loading books', error.message))
  }
}
Exemple #2
0
function * updateBookSaga ({ book }) {
  const uid = yield select(state => state.getIn(['user', 'uid']))

  try {
    yield call(
      rsf.database.update,
      `books/${uid}/${book.get('bid')}`,
      bookTransformer.serialize(book)
    )
    yield put(updateBookSuccess(book))
  } catch (error) {
    yield put(updateBookFailure(error))
    yield put(notifyError('Error while updating book', error.message))
  }
}