mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
32 lines
737 B
JavaScript
32 lines
737 B
JavaScript
import ApiService from 'services/ApiService';
|
|
import t from 'store/types';
|
|
|
|
export const submitOptions = ({ form }) => {
|
|
return (dispatch) => {
|
|
return ApiService.post('settings', form).then((response) => {
|
|
dispatch({
|
|
type: t.SETTING_SET,
|
|
options: form.options,
|
|
});
|
|
return response;
|
|
});
|
|
};
|
|
};
|
|
|
|
export const FetchOptions = ({ form }) => {
|
|
return (dispatch) =>
|
|
new Promise((resolve, reject) => {
|
|
ApiService.get('settings')
|
|
.then((response) => {
|
|
dispatch({
|
|
type: t.SETTING_SET,
|
|
options: response.data.settings,
|
|
});
|
|
resolve(response);
|
|
})
|
|
.catch((error) => {
|
|
reject(error);
|
|
});
|
|
});
|
|
};
|