mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
WIP
This commit is contained in:
26
client/src/store/preferences/preferences.actions.js
Normal file
26
client/src/store/preferences/preferences.actions.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import ApiService from "services/ApiService";
|
||||
import t from 'store/types';
|
||||
|
||||
export const savePreferences = ({ options }) => {
|
||||
return (dispatch) => new Promise((resolve, reject) => {
|
||||
ApiService.post('options', { options }).then((response) => {
|
||||
dispatch({
|
||||
type: t.OPTIONS_SET,
|
||||
options: response.data.options,
|
||||
});
|
||||
resolve(response);
|
||||
}).catch(error => { reject(error); });
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchPreferences = () => {
|
||||
return (dispatch) => new Promise((resolve, reject) => {
|
||||
ApiService.get('options').then((response) => {
|
||||
dispatch({
|
||||
type: t.OPTIONS.SET,
|
||||
options: response.data.options,
|
||||
});
|
||||
resolve(response);
|
||||
}).catch(error => { reject(error); });
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user