diff options
Diffstat (limited to 'src/client/react')
| -rw-r--r-- | src/client/react/components/container/View.js | 4 | ||||
| -rw-r--r-- | src/client/react/lib/extractSchedule.js | 5 | ||||
| -rw-r--r-- | src/client/react/reducers.js | 13 | 
3 files changed, 6 insertions, 16 deletions
diff --git a/src/client/react/components/container/View.js b/src/client/react/components/container/View.js index b374300..7c0d42c 100644 --- a/src/client/react/components/container/View.js +++ b/src/client/react/components/container/View.js @@ -31,10 +31,10 @@ import Loading from '../presentational/Loading';  class View extends React.Component {    static propTypes = { -    schedules: PropTypes.objectOf(PropTypes.objectOf(PropTypes.shape({ +    schedules: PropTypes.objectOf(PropTypes.shape({        state: PropTypes.string.isRequired,        htmlStr: PropTypes.string, -    }))).isRequired, +    })).isRequired,      // react-router      match: PropTypes.object.isRequired, diff --git a/src/client/react/lib/extractSchedule.js b/src/client/react/lib/extractSchedule.js index 97589f8..6f30970 100644 --- a/src/client/react/lib/extractSchedule.js +++ b/src/client/react/lib/extractSchedule.js @@ -19,12 +19,11 @@   */  export default function extractSchedule(schedules, user, week) { -  const scheduleExists = -    schedules.hasOwnProperty(user) && schedules[user].hasOwnProperty(week); +  const scheduleExists = schedules.hasOwnProperty(`${user}:${week}`);    if (!scheduleExists) {      return { state: 'NOT_REQUESTED' };    } -  return schedules[user][week]; +  return schedules[`${user}:${week}`];  } 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),          },        };  | 
