Permalink
Browse files

Implement unit info update logic

  • Loading branch information...
markerikson committed Jan 11, 2017
1 parent bba6aa9 commit 7352c4f5c16af242915c81470c2b3c7b44b98a61
@@ -0,0 +1,8 @@
import {UNIT_INFO_UPDATE} from "./unitInfoConstants";
export function updateUnitInfo(values) {
return {
type : UNIT_INFO_UPDATE,
payload : values,
};
}
@@ -0,0 +1 @@
export const UNIT_INFO_UPDATE = "UNIT_INFO_UPDATE";
@@ -1,6 +1,7 @@
import {createReducer} from "common/utils/reducerUtils";
import {DATA_LOADED} from "features/tools/toolConstants";
import {UNIT_INFO_UPDATE} from "./unitInfoConstants";
const initialState = {
name : "N/A",
@@ -13,6 +14,14 @@ function dataLoaded(state, payload) {
return unit;
}
function updateUnitInfo(state, payload) {
return {
...state,
...payload,
};
}
export default createReducer(initialState, {
[DATA_LOADED] : dataLoaded,
[UNIT_INFO_UPDATE] : updateUnitInfo,
});

0 comments on commit 7352c4f

Please sign in to comment.