aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/lib
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-01-28 19:11:00 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-01-28 19:11:00 +0100
commit7dd214d57c7dab9626abef1516a862f46c1e02bd (patch)
tree9fb9c0060d0e595550a064caa4efb4289d2b7eb8 /src/client/react/lib
parent9f438225db07b7214e4a41d133634309cba80073 (diff)
Refactor View.js
Diffstat (limited to 'src/client/react/lib')
-rw-r--r--src/client/react/lib/extractSchedule.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/client/react/lib/extractSchedule.js b/src/client/react/lib/extractSchedule.js
new file mode 100644
index 0000000..e74411b
--- /dev/null
+++ b/src/client/react/lib/extractSchedule.js
@@ -0,0 +1,10 @@
+export default function extractSchedule(schedules, user, week) {
+ const scheduleExists =
+ schedules.hasOwnProperty(user) && schedules[user].hasOwnProperty(week);
+
+ if (!scheduleExists) {
+ return { state: 'NOT_REQUESTED' };
+ }
+
+ return schedules[user][week];
+}