client/src/sagas/index.js
changeset 53 d8588379529e
parent 47 64428c7ebc19
child 54 fad489be9c77
--- a/client/src/sagas/index.js	Mon Jun 19 15:36:52 2017 +0200
+++ b/client/src/sagas/index.js	Mon Jun 19 17:56:41 2017 +0200
@@ -137,6 +137,22 @@
   }
 }
 
+function* watchUpdateSettings() {
+  while (true) {
+    const { username, firstname, lastname } = yield take(types.USER_UPDATE_SETTINGS_ASYNC);
+    try {
+      yield client.put('/api/auth/user/', {
+        username,
+        first_name: firstname,
+        last_name: lastname
+      });
+      yield put({ type: types.USER_UPDATE_SETTINGS, firstname, lastname });
+    } catch (e) {
+
+    }
+  }
+}
+
 // ---
 
 export default function* rootSaga() {
@@ -149,5 +165,6 @@
     watchLoginSubmit(),
     watchLoginRequest(),
     watchStoreToken(),
+    watchUpdateSettings(),
   ])
 }