aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/reducers/view.js
blob: 276d8ae12a4d96b73e5989eb5de935c37e8aa6c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const DEFAULT_STATE = {
  schedules: {},
};

const view = (state = DEFAULT_STATE, action) => {
  switch (action.type) {
    case 'VIEW/FETCH_SCHEDULE_REQUEST':
      return {
        ...state,
        schedules: {
          ...state.schedules,
          [action.user]: {
            state: 'fetching',
          },
        },
      };
    case 'VIEW/FETCH_SCHEDULE_SUCCESS':
      return {
        ...state,
        schedules: {
          ...state.schedules,
          [action.user]: {
            ...state.schedules[action.user],
            state: 'finished',
            htmlStr: action.htmlStr,
          },
        },
      };
    default:
      return state;
  }
};

export default view;

export const _test = {
  DEFAULT_STATE,
};