client/src/sagas/index.js
changeset 40 7f940dbb60a6
parent 30 4d93f4ed95bc
child 44 3b20e2b584fe
equal deleted inserted replaced
39:cb014270bdc6 40:7f940dbb60a6
    43 export function* updateSession(action) {
    43 export function* updateSession(action) {
    44 
    44 
    45   const { _id } = action.session;
    45   const { _id } = action.session;
    46   let session;
    46   let session;
    47 
    47 
    48   const response = yield sessionsDB.get(_id).then(function(doc) {
    48   const doc = yield sessionsDB.get(_id);
    49     session = Object.assign({}, doc, action.values);
    49   session = Object.assign({}, doc, action.values);
    50     return sessionsDB.put(session);
    50   const response = yield sessionsDB.put(session);
    51   });
       
    52 
    51 
    53   yield put({
    52   yield put({
    54     type: types.UPDATE_SESSION,
    53     type: types.UPDATE_SESSION,
    55     session: Object.assign({}, session, { rev: response.rev })
    54     session: Object.assign({}, session, { rev: response.rev })
    56   })
    55   })