You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
663 B

  1. export const LOCAL_SETTING_CHANGE = 'LOCAL_SETTING_CHANGE';
  2. export function changeLocalSetting(key, value) {
  3. return dispatch => {
  4. dispatch({
  5. type: LOCAL_SETTING_CHANGE,
  6. key,
  7. value,
  8. });
  9. dispatch(saveLocalSettings());
  10. };
  11. };
  12. // __TODO :__
  13. // Right now `saveLocalSettings()` doesn't keep track of which user
  14. // is currently signed in, but it might be better to give each user
  15. // their *own* local settings.
  16. export function saveLocalSettings() {
  17. return (_, getState) => {
  18. const localSettings = getState().get('local_settings').toJS();
  19. localStorage.setItem('mastodon-settings', JSON.stringify(localSettings));
  20. };
  21. };