Refactor /api/web APIs to use the centralized axios instance (tootsuite pr #6223)

This commit is contained in:
cwm
2018-01-09 10:51:14 -06:00
parent f43c2f12f3
commit aef4b1af66
5 changed files with 21 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
import axios from 'axios';
import api from 'flavours/glitch/util/api';
import { debounce } from 'lodash';
export const SETTING_CHANGE = 'SETTING_CHANGE';
@@ -23,7 +23,7 @@ const debouncedSave = debounce((dispatch, getState) => {
const data = getState().get('settings').filter((_, path) => path !== 'saved').toJS();
axios.put('/api/web/settings', { data }).then(() => dispatch({ type: SETTING_SAVE }));
api(getState).put('/api/web/settings', { data }).then(() => dispatch({ type: SETTING_SAVE }));
}, 5000, { trailing: true });
export function saveSettings() {