store.ts 1.87 KB
Newer Older
1
2
import { combineReducers } from 'redux';
import * as courseFields from './coursefields';
3
import * as sectorFields from './sectorfields';
4
import * as regions from './regionschools';
5
import * as sectors from './sectorcourses';
6
import * as studentDataFields from './studentdatafields';
Open Source Developer's avatar
Open Source Developer committed
7
import * as epalclasses from './epalclasses';
8
import * as loginInfo from './logininfo';
9
import * as criter from './criteria';
10
11
12
13
14
15
16

/*
 * This is where we 'assemble' the full store out of its modules.
 */

export interface IAppState {
    courseFields?: courseFields.ICourseFields;
17
    sectorFields?: sectorFields.ISectorFields;
18
    regions?: regions.IRegionRecords;
19
    sectors?: sectors.ISectors;
20
    studentDataFields?: studentDataFields.IStudentDataFields;
Open Source Developer's avatar
Open Source Developer committed
21
    epalclasses?: epalclasses.IEpalClasses;
22
    loginInfo?: loginInfo.ILoginInfo;
23
    criter?: criter.ICriter;
24
25
26
27
};

export const rootReducer = combineReducers<IAppState>({
   courseFields: courseFields.courseFieldsReducer,
28
   sectorFields: sectorFields.sectorFieldsReducer,
29
   regions: regions.regionSchoolsReducer,
30
   sectors: sectors.sectorCoursesReducer,
31
   studentDataFields: studentDataFields.studentDataFieldsReducer,
Open Source Developer's avatar
Open Source Developer committed
32
   epalclasses: epalclasses.epalclassesReducer,
33
   loginInfo: loginInfo.loginInfoReducer,
34
   criter: criter.criteriaReducer,
35

36
37
38
39
});

export function deimmutify(state: IAppState): Object {
  return {
40
    courseFields: courseFields.deimmutifyCourseFields(state.courseFields),
41
    sectorFields: sectorFields.deimmutifySectorFields(state.sectorFields),
42
    regions: regions.deimmutifyRegionSchools(state.regions),
43
    sectors: sectors.deimmutifySectorCourses(state.sectors),
44
    studentdataFields: studentDataFields.deimmutifyStudentDataFields(state.studentDataFields),
Open Source Developer's avatar
Open Source Developer committed
45
    epalclasses: epalclasses.deimmutifyEpalClasses(state.epalclasses),
46
    loginInfo: loginInfo.deimmutifyLoginInfo(state.loginInfo),
47
    criter: criter.deimmutifyCriteria(state.criter)
48
49
  };
}