mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
WIP
This commit is contained in:
24
client/src/store/customFields/customFields.reducer.js
Normal file
24
client/src/store/customFields/customFields.reducer.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import {createReducer} from '@reduxjs/toolkit';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
custom_fields: {
|
||||
accounts: [{
|
||||
label_name: 'Label',
|
||||
predefined: true,
|
||||
data_type: 'text',
|
||||
help_text: '123sdasd',
|
||||
active: true,
|
||||
}]
|
||||
},
|
||||
};
|
||||
|
||||
export default createReducer(initialState, {
|
||||
[t.CUSTOM_FIELDS_RESOURCE_SET]: (state, action) => {
|
||||
state.fields.custom_fields[action.resource_slug] = action.custom_field;
|
||||
}
|
||||
});
|
||||
|
||||
export const getCustomFieldsByResource = (state, resourceSlug) => {
|
||||
return state.fields.custom_fields[resourceSlug];
|
||||
}
|
||||
Reference in New Issue
Block a user