aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/reducers
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-01-17 16:26:04 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-01-17 16:26:04 +0100
commit1b3f4ea79f947558573fbce5a2e2d0c2c5dd6a8d (patch)
tree52a41cbd31a69de31edf83578e3055d076fa1c3e /src/client/react/reducers
parentc0aa588bc8f85b13b5a55ccd6cdf11bf99048a1c (diff)
Add view code
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,
+};