mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
Merge remote-tracking branch 'origin/feature/general'
This commit is contained in:
@@ -2,5 +2,6 @@ export default {
|
||||
ITEMS_CATEGORY_LIST_SET: 'ITEMS_CATEGORY_LIST_SET',
|
||||
ITEMS_CATEGORY_DATA_TABLE: 'ITEMS_CATEGORY_DATA_TABLE',
|
||||
CATEGORY_DELETE: 'CATEGORY_DELETE',
|
||||
CLEAR_CATEGORY_FORM_ERRORS: 'CLEAR_CATEGORY_FORM_ERRORS'
|
||||
CLEAR_CATEGORY_FORM_ERRORS: 'CLEAR_CATEGORY_FORM_ERRORS',
|
||||
CATEGORY_COUNTER:'CATEGORY_COUNTER'
|
||||
};
|
||||
|
||||
@@ -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',
|
||||
};
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { createReducer } from "@reduxjs/toolkit";
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
list: {},
|
||||
list: {
|
||||
results: [],
|
||||
},
|
||||
userById: {},
|
||||
};
|
||||
|
||||
@@ -14,13 +16,13 @@ export default createReducer(initialState, {
|
||||
[t.USER_DETAILS_SET]: (state, action) => {
|
||||
state.userById[action.user.id] = action.user;
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
/**
|
||||
* Retrieve the user details of the given user id,
|
||||
* @param {Object} state
|
||||
* @param {Numeric} id
|
||||
* @param {Object} state
|
||||
* @param {Numeric} id
|
||||
*/
|
||||
export const getUserDetails = (state, id) => {
|
||||
return state.users.userById[id];
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user