closer to running

This commit is contained in:
Luke Berndt
2021-01-14 22:22:46 -05:00
parent 86eb854848
commit e20529b7f5
19 changed files with 51 additions and 141 deletions

View File

@@ -4,26 +4,6 @@ import {
FETCH_ERROR_GROUP
} from "./group-constants";
function updateObject(oldObject, newValues) {
// Encapsulate the idea of passing a new object as the first parameter
// to Object.assign to ensure we correctly copy data instead of mutating
return Object.assign({}, oldObject, newValues);
}
function updateItemInArray(array, itemId, updateItemCallback) {
const updatedItems = array.map(item => {
if(item.id !== itemId) {
// Since we only want to update one item, preserve all others as they are now
return item;
}
// Use the provided callback to create an updated item
const updatedItem = updateItemCallback(item);
return updatedItem;
});
return updatedItems;
}
const group = (
state = {