about summary refs log tree commit diff
path: root/app/javascript/glitch/actions
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2017-07-12 01:02:51 -0700
committerkibigo! <marrus-sh@users.noreply.github.com>2017-07-12 01:02:51 -0700
commit297921fce570bfab413bab4e16a4ae694ecc4f28 (patch)
tree279bd98fe3102bd607c222f0497b7549fbb749d8 /app/javascript/glitch/actions
parent74eff5456c8655e6783ffe49a96042320af3848c (diff)
Moved glitch files to their own location ;)
Diffstat (limited to 'app/javascript/glitch/actions')
-rw-r--r--app/javascript/glitch/actions/local_settings.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/javascript/glitch/actions/local_settings.js b/app/javascript/glitch/actions/local_settings.js
new file mode 100644
index 000000000..18e0c245c
--- /dev/null
+++ b/app/javascript/glitch/actions/local_settings.js
@@ -0,0 +1,20 @@
+export const LOCAL_SETTING_CHANGE = 'LOCAL_SETTING_CHANGE';
+
+export function changeLocalSetting(key, value) {
+  return dispatch => {
+    dispatch({
+      type: LOCAL_SETTING_CHANGE,
+      key,
+      value,
+    });
+
+    dispatch(saveLocalSettings());
+  };
+};
+
+export function saveLocalSettings() {
+  return (_, getState) => {
+    const localSettings = getState().get('local_settings').toJS();
+    localStorage.setItem('mastodon-settings', JSON.stringify(localSettings));
+  };
+};