From c6b1e5a800bf3501d0215d08218c2112d195b1e0 Mon Sep 17 00:00:00 2001 From: David Jay Date: Mon, 21 Nov 2016 16:54:01 -0500 Subject: [PATCH] Adding frontend IDs to facilitate management of actions. --- client/coral-framework/actions/items.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/coral-framework/actions/items.js b/client/coral-framework/actions/items.js index 2dad64639..490e7a04c 100644 --- a/client/coral-framework/actions/items.js +++ b/client/coral-framework/actions/items.js @@ -103,8 +103,16 @@ export function getStream (assetUrl) { /* Add items to the store */ const itemTypes = Object.keys(json); for (let i = 0; i < itemTypes.length; i++ ) { - for (let j = 0; j < json[itemTypes[i]].length; j++ ) { - dispatch(addItem(json[itemTypes[i]][j], itemTypes[i])); + if (itemTypes[i] === 'actions') { + for (let j = 0; j < json[itemTypes[i]].length; j++ ) { + let action = json[itemTypes[i]][j]; + action.id = `${action.action_type}_${action.item_id}`; + dispatch(addItem(action, 'actions')); + } + } else { + for (let j = 0; j < json[itemTypes[i]].length; j++ ) { + dispatch(addItem(json[itemTypes[i]][j], itemTypes[i])); + } } }