summaryrefslogtreecommitdiffstats
path: root/web/react/stores/admin_store.jsx
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-09-17 21:00:59 -0700
committer=Corey Hulen <corey@hulen.com>2015-09-17 21:00:59 -0700
commit44714dfcb18b9a393dc34be3c182b0c092eec28a (patch)
tree117bc8a3bc37f9112abf5498248c779081df514f /web/react/stores/admin_store.jsx
parent82127341cacd4299f9a59e76b5f68d6d7222c45b (diff)
downloadchat-44714dfcb18b9a393dc34be3c182b0c092eec28a.tar.gz
chat-44714dfcb18b9a393dc34be3c182b0c092eec28a.tar.bz2
chat-44714dfcb18b9a393dc34be3c182b0c092eec28a.zip
PLT-11 Adding ability to save config file
Diffstat (limited to 'web/react/stores/admin_store.jsx')
-rw-r--r--web/react/stores/admin_store.jsx30
1 files changed, 30 insertions, 0 deletions
diff --git a/web/react/stores/admin_store.jsx b/web/react/stores/admin_store.jsx
index 591b52d05..dd5b60a24 100644
--- a/web/react/stores/admin_store.jsx
+++ b/web/react/stores/admin_store.jsx
@@ -8,16 +8,22 @@ var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes;
var LOG_CHANGE_EVENT = 'log_change';
+var CONFIG_CHANGE_EVENT = 'config_change';
class AdminStoreClass extends EventEmitter {
constructor() {
super();
this.logs = null;
+ this.config = null;
this.emitLogChange = this.emitLogChange.bind(this);
this.addLogChangeListener = this.addLogChangeListener.bind(this);
this.removeLogChangeListener = this.removeLogChangeListener.bind(this);
+
+ this.emitConfigChange = this.emitConfigChange.bind(this);
+ this.addConfigChangeListener = this.addConfigChangeListener.bind(this);
+ this.removeConfigChangeListener = this.removeConfigChangeListener.bind(this);
}
emitLogChange() {
@@ -32,6 +38,18 @@ class AdminStoreClass extends EventEmitter {
this.removeListener(LOG_CHANGE_EVENT, callback);
}
+ emitConfigChange() {
+ this.emit(CONFIG_CHANGE_EVENT);
+ }
+
+ addConfigChangeListener(callback) {
+ this.on(CONFIG_CHANGE_EVENT, callback);
+ }
+
+ removeConfigChangeListener(callback) {
+ this.removeListener(CONFIG_CHANGE_EVENT, callback);
+ }
+
getLogs() {
return this.logs;
}
@@ -39,6 +57,14 @@ class AdminStoreClass extends EventEmitter {
saveLogs(logs) {
this.logs = logs;
}
+
+ getConfig() {
+ return this.config;
+ }
+
+ saveConfig(config) {
+ this.config = config;
+ }
}
var AdminStore = new AdminStoreClass();
@@ -51,6 +77,10 @@ AdminStoreClass.dispatchToken = AppDispatcher.register((payload) => {
AdminStore.saveLogs(action.logs);
AdminStore.emitLogChange();
break;
+ case ActionTypes.RECIEVED_CONFIG:
+ AdminStore.saveConfig(action.config);
+ AdminStore.emitConfigChange();
+ break;
default:
}
});