chore: Update the usage with camel case
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as MutationHelpers from 'shared/helpers/vuex/mutationHelpers';
|
||||
import types from '../mutation-types';
|
||||
import AttributeAPI from '../../api/attributes';
|
||||
import camelcaseKeys from 'camelcase-keys';
|
||||
|
||||
export const state = {
|
||||
records: [],
|
||||
@@ -24,6 +25,12 @@ export const getters = {
|
||||
record => record.attribute_model === attributeModel
|
||||
);
|
||||
},
|
||||
getAttributesByModelType: _state => attributeModel => {
|
||||
const records = _state.records.filter(
|
||||
record => record.attribute_model === attributeModel
|
||||
);
|
||||
return camelcaseKeys(records, { deep: true });
|
||||
},
|
||||
};
|
||||
|
||||
export const actions = {
|
||||
|
||||
@@ -4,6 +4,12 @@ export const getters = {
|
||||
getContacts($state) {
|
||||
return $state.sortOrder.map(contactId => $state.records[contactId]);
|
||||
},
|
||||
getContactsList($state) {
|
||||
const contacts = $state.sortOrder.map(
|
||||
contactId => $state.records[contactId]
|
||||
);
|
||||
return camelcaseKeys(contacts, { deep: true });
|
||||
},
|
||||
getUIFlags($state) {
|
||||
return $state.uiFlags;
|
||||
},
|
||||
@@ -13,7 +19,7 @@ export const getters = {
|
||||
},
|
||||
getContactById: $state => id => {
|
||||
const contact = $state.records[id];
|
||||
return camelcaseKeys(contact || {});
|
||||
return camelcaseKeys(contact || {}, { deep: true });
|
||||
},
|
||||
getMeta: $state => {
|
||||
return $state.meta;
|
||||
|
||||
Reference in New Issue
Block a user