From 4269b3c3cf033c4f6613c71124c380a0b0b5edd8 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Mon, 16 Mar 2020 11:14:32 +0530 Subject: [PATCH] Fix classes reducer to use {} as default state. Add subjects reducer. --- reducers/classes.js | 2 +- reducers/index.js | 4 +++- reducers/subjects.js | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 reducers/subjects.js diff --git a/reducers/classes.js b/reducers/classes.js index bcd6799..9496b89 100644 --- a/reducers/classes.js +++ b/reducers/classes.js @@ -1,5 +1,5 @@ export default function classes(state) { if (typeof state === "undefined") - return []; + return {}; return state; } diff --git a/reducers/index.js b/reducers/index.js index 509d9a2..5cc5567 100644 --- a/reducers/index.js +++ b/reducers/index.js @@ -2,10 +2,12 @@ import { combineReducers } from "redux"; import timetable from "./timetable"; import classes from "./classes"; +import subjects from "./subjects"; const rootReducer = combineReducers({ timetable, - classes + classes, + subjects, }); export default rootReducer; diff --git a/reducers/subjects.js b/reducers/subjects.js new file mode 100644 index 0000000..ebf2956 --- /dev/null +++ b/reducers/subjects.js @@ -0,0 +1,5 @@ +export default function subjects(state) { + if (typeof state === "undefined") + return []; + return state; +}