]>
cat aescling's git repositories - mastodon.git/blob - app/javascript/themes/glitch/actions/settings.js
1 import axios
from 'axios';
2 import { debounce
} from 'lodash';
4 export const SETTING_CHANGE
= 'SETTING_CHANGE';
5 export const SETTING_SAVE
= 'SETTING_SAVE';
7 export function changeSetting(key
, value
) {
15 dispatch(saveSettings());
19 const debouncedSave
= debounce((dispatch
, getState
) => {
20 if (getState().getIn(['settings', 'saved'])) {
24 const data
= getState().get('settings').filter((_
, key
) => key
!== 'saved').toJS();
26 axios
.put('/api/web/settings', { data
}).then(() => dispatch({ type: SETTING_SAVE
}));
27 }, 5000, { trailing: true });
29 export function saveSettings() {
30 return (dispatch
, getState
) => debouncedSave(dispatch
, getState
);
This page took 0.084593 seconds and 4 git commands to generate.