mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
WIP Feature / General & Users & Sidebar
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import ApiService from 'services/ApiService';
|
||||
import t from 'store/types';
|
||||
|
||||
export const submitOptions = ({ form }) => {
|
||||
return (dispatch) => {
|
||||
return ApiService.post('options', form);
|
||||
};
|
||||
};
|
||||
|
||||
export const FetchOptions = ({ form }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.get('options')
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.SETTING_SET,
|
||||
options: response.data.options,
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import t from 'store/types';
|
||||
|
||||
import { optionsArrayToMap } from 'utils';
|
||||
const initialState = {
|
||||
data: {
|
||||
organization: {
|
||||
name: 'Bigcapital, Limited Liabilities',
|
||||
},
|
||||
organization: {},
|
||||
},
|
||||
};
|
||||
|
||||
export default createReducer(initialState, {
|
||||
['asdfas']: (state, action) => {
|
||||
|
||||
[t.SETTING_SET]: (state, action) => {
|
||||
const { options } = action;
|
||||
|
||||
state.data.organization = optionsArrayToMap(options);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
};
|
||||
SETTING_LIST_SET: 'SETTING_LIST_SET',
|
||||
CLEAR_OPTIONS_FORM_ERRORS: 'CLEAR_OPTIONS_FORM_ERRORS',
|
||||
SETTING_SET: 'SETTING_SET',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user