Permalink
Browse files

Add editing utility functions

  • Loading branch information...
markerikson committed Jan 25, 2017
1 parent fbcad74 commit 57b924ce9a25ce9daaf523b496ffadffedfebae7
Showing with 27 additions and 0 deletions.
  1. +27 −0 src/features/editing/editingUtils.js
@@ -0,0 +1,27 @@
import schema from "app/schema";
import {getModelByType} from "common/utils/modelUtils";
export function updateEditingEntitiesState(state, updatedEditingEntities) {
return {
...state,
editingEntities : updatedEditingEntities,
};
}
export function updateEntitiesState(state, updatedEntities) {
return {
...state,
entities : updatedEntities,
};
}
export function readEntityData(entities, itemType, itemID) {
const readSession = schema.from(entities);
// Look up the model instance for the requested item
const model = getModelByType(readSession, itemType, itemID);
const data = model.toJSON();
return data;
}

0 comments on commit 57b924c

Please sign in to comment.