Files
bigcapital/client/src/store/customFields/customFields.reducer.js
Ahmed Bouhuolia 73711384f6 WIP
2020-03-16 00:06:15 +02:00

24 lines
583 B
JavaScript

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];
}