From 7d4a9ad376cf346826ab13b7c0d4eec60eb5cb7d Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Mon, 7 Dec 2015 18:13:14 -0500
Subject: Added preference_changed web socket event

---
 web/react/stores/preference_store.jsx | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

(limited to 'web/react/stores/preference_store.jsx')

diff --git a/web/react/stores/preference_store.jsx b/web/react/stores/preference_store.jsx
index 068bc29c2..e6a1d8a2b 100644
--- a/web/react/stores/preference_store.jsx
+++ b/web/react/stores/preference_store.jsx
@@ -90,8 +90,8 @@ class PreferenceStoreClass extends EventEmitter {
         return preference;
     }
 
-    emitChange(preferences) {
-        this.emit(CHANGE_EVENT, preferences);
+    emitChange() {
+        this.emit(CHANGE_EVENT);
     }
 
     addChangeListener(callback) {
@@ -106,6 +106,12 @@ class PreferenceStoreClass extends EventEmitter {
         const action = payload.action;
 
         switch (action.type) {
+        case ActionTypes.RECIEVED_PREFERENCE: {
+            const preference = action.preference;
+            this.setPreference(preference.category, preference.name, preference.value);
+            this.emitChange();
+            break;
+        }
         case ActionTypes.RECIEVED_PREFERENCES: {
             const preferences = this.getAllPreferences();
 
@@ -114,7 +120,7 @@ class PreferenceStoreClass extends EventEmitter {
             }
 
             this.setAllPreferences(preferences);
-            this.emitChange(preferences);
+            this.emitChange();
             break;
         }
         }
-- 
cgit v1.2.3-1-g7c22

