Fix classes reducer to use {} as default state. Add subjects reducer.

This commit is contained in:
Ceda EI 2020-03-16 11:14:32 +05:30
parent b7d68bdf77
commit 4269b3c3cf
3 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,5 @@
export default function classes(state) { export default function classes(state) {
if (typeof state === "undefined") if (typeof state === "undefined")
return []; return {};
return state; return state;
} }

View File

@ -2,10 +2,12 @@ import { combineReducers } from "redux";
import timetable from "./timetable"; import timetable from "./timetable";
import classes from "./classes"; import classes from "./classes";
import subjects from "./subjects";
const rootReducer = combineReducers({ const rootReducer = combineReducers({
timetable, timetable,
classes classes,
subjects,
}); });
export default rootReducer; export default rootReducer;

5
reducers/subjects.js Normal file
View File

@ -0,0 +1,5 @@
export default function subjects(state) {
if (typeof state === "undefined")
return [];
return state;
}