diff -r 4cfeabef7d5e -r 4d93f4ed95bc client/src/sagas/index.js --- a/client/src/sagas/index.js Mon Jun 12 18:12:38 2017 +0200 +++ b/client/src/sagas/index.js Wed Jun 14 12:28:09 2017 +0200 @@ -40,6 +40,28 @@ // --- +export function* updateSession(action) { + + const { _id } = action.session; + let session; + + const response = yield sessionsDB.get(_id).then(function(doc) { + session = Object.assign({}, doc, action.values); + return sessionsDB.put(session); + }); + + yield put({ + type: types.UPDATE_SESSION, + session: Object.assign({}, session, { rev: response.rev }) + }) +} + +export function* watchUpdateSession() { + yield takeLatest(types.UPDATE_SESSION_ASYNC, updateSession) +} + +// --- + export function* addNote(action) { const response = yield notesDB.put(action.note); // TODO Error control @@ -73,5 +95,6 @@ watchLoadNotesBySession(), watchAddNote(), watchCreateSession(), + watchUpdateSession(), ]) }