diff options
author | Noah Loomans <noahloomans@gmail.com> | 2018-02-19 22:59:35 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2018-02-19 22:59:35 +0100 |
commit | df1af158484b25c2a250c3ff3b3c72df2c562bb3 (patch) | |
tree | fcec0395a18b89e9da6b7697b87f1cc8d1ec3a74 /src/client/react/reducers.js | |
parent | 5be066cc2714ca6cbd75d8786c859d8767df0ccb (diff) |
Simplify schedule state
Diffstat (limited to 'src/client/react/reducers.js')
-rw-r--r-- | src/client/react/reducers.js | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/client/react/reducers.js b/src/client/react/reducers.js index accf464..cd84ee5 100644 --- a/src/client/react/reducers.js +++ b/src/client/react/reducers.js @@ -115,17 +115,8 @@ function reducer(state = DEFAULT_STATE, action) { ...state, schedules: { ...state.schedules, - [action.user]: - state.schedules[action.user] - ? { - // This user already exists in our state, extend it. - ...state.schedules[action.user], - [action.week]: schedule(state.schedules[action.user][action.week], action), - } - : { - // This user does not already exist in our state. - [action.week]: schedule(undefined, action), - }, + [`${action.user}:${action.week}`]: + schedule(state.schedules[`${action.user}:${action.week}`], action), }, }; |