Use yields instead of promises
authorymh <ymh.work@gmail.com>
Thu, 15 Jun 2017 15:27:36 +0200
changeset 40 7f940dbb60a6
parent 39 cb014270bdc6
child 41 aec51a27ca54
Use yields instead of promises
client/src/sagas/index.js
--- a/client/src/sagas/index.js	Thu Jun 15 13:00:32 2017 +0200
+++ b/client/src/sagas/index.js	Thu Jun 15 15:27:36 2017 +0200
@@ -45,10 +45,9 @@
   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);
-  });
+  const doc = yield sessionsDB.get(_id);
+  session = Object.assign({}, doc, action.values);
+  const response = yield sessionsDB.put(session);
 
   yield put({
     type: types.UPDATE_SESSION,