feat: Add custom attribute table (#2929)

This commit is contained in:
Sivin Varghese
2021-09-08 09:37:58 +05:30
committed by GitHub
parent 39c4fa111a
commit c80289e661
9 changed files with 242 additions and 42 deletions

View File

@@ -14,18 +14,18 @@ export const getters = {
getUIFlags(_state) {
return _state.uiFlags;
},
getAttributes: _state => attributeType => {
getAttributesByModel: _state => attributeModel => {
return _state.records.filter(
record => record.attribute_display_type === attributeType
record => record.attribute_model === attributeModel
);
},
};
export const actions = {
get: async function getAttributes({ commit }) {
get: async function getAttributesByModel({ commit }, modelId) {
commit(types.SET_CUSTOM_ATTRIBUTE_UI_FLAG, { isFetching: true });
try {
const response = await AttributeAPI.get();
const response = await AttributeAPI.getAttributesByModel(modelId);
commit(types.SET_CUSTOM_ATTRIBUTE, response.data);
} catch (error) {
// Ignore error