about summary refs log tree commit diff
path: root/app/javascript/mastodon/actions/settings.js
blob: f9d304c96a37bd3a72bd1dcf700f4b4ae4e5ff9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import axios from 'axios';

export const SETTING_CHANGE = 'SETTING_CHANGE';

export function changeSetting(key, value) {
  return dispatch => {
    dispatch({
      type: SETTING_CHANGE,
      key,
      value,
    });

    dispatch(saveSettings());
  };
};

export function saveSettings() {
  return (_, getState) => {
    axios.put('/api/web/settings', {
      data: getState().get('settings').toJS(),
    });
  };
};