diff --git a/client/constants.js b/client/constants.js
index 3c22e79c..e440c93f 100644
--- a/client/constants.js
+++ b/client/constants.js
@@ -84,6 +84,7 @@ export const SET_TOAST_TEXT = 'SET_TOAST_TEXT';
export const SET_THEME = 'SET_THEME';
export const SET_UNSAVED_CHANGES = 'SET_UNSAVED_CHANGES';
+export const SET_AUTOREFRESH = 'SET_AUTOREFRESH';
export const DETECT_INFINITE_LOOPS = 'DETECT_INFINITE_LOOPS';
export const RESET_INFINITE_LOOPS = 'RESET_INFINITE_LOOPS';
diff --git a/client/modules/IDE/actions/preferences.js b/client/modules/IDE/actions/preferences.js
index 6b3964ef..5d8bc4b1 100644
--- a/client/modules/IDE/actions/preferences.js
+++ b/client/modules/IDE/actions/preferences.js
@@ -138,9 +138,46 @@ export function setTextOutput(value) {
}
export function setTheme(value) {
- return {
- type: ActionTypes.SET_THEME,
- value
+ // return {
+ // type: ActionTypes.SET_THEME,
+ // value
+ // };
+ return (dispatch, getState) => {
+ dispatch({
+ type: ActionTypes.SET_THEME,
+ value
+ });
+ const state = getState();
+ if (state.user.authenticated) {
+ const formParams = {
+ preferences: {
+ theme: value
+ }
+ };
+ updatePreferences(formParams, dispatch);
+ }
+ };
+}
+
+export function setAutorefresh(value) {
+ // return {
+ // type: ActionTypes.SET_AUTOREFRESH,
+ // value
+ // };
+ return (dispatch, getState) => {
+ dispatch({
+ type: ActionTypes.SET_AUTOREFRESH,
+ value
+ });
+ const state = getState();
+ if (state.user.authenticated) {
+ const formParams = {
+ preferences: {
+ autorefresh: value
+ }
+ };
+ updatePreferences(formParams, dispatch);
+ }
};
}
diff --git a/client/modules/IDE/components/Toolbar.js b/client/modules/IDE/components/Toolbar.js
index 6a4f773d..e2c952e2 100644
--- a/client/modules/IDE/components/Toolbar.js
+++ b/client/modules/IDE/components/Toolbar.js
@@ -73,6 +73,10 @@ class Toolbar extends React.Component {
{
+ this.props.setAutorefresh(event.target.checked);
+ }}
/>