aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/lib
diff options
context:
space:
mode:
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];
+}