aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/reducers
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/react/reducers')
-rw-r--r--src/client/react/reducers/view.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/client/react/reducers/view.js b/src/client/react/reducers/view.js
new file mode 100644
index 0000000..276d8ae
--- /dev/null
+++ b/src/client/react/reducers/view.js
@@ -0,0 +1,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,
+};