store.ts 2.06 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';
Open Source Developer's avatar
Open Source Developer committed
8
import * as amkafills from './amkafill';
9
import * as loginInfo from './logininfo';
10
import * as criter from './criteria';
11 12 13 14 15 16 17

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

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

export const rootReducer = combineReducers<IAppState>({
   courseFields: courseFields.courseFieldsReducer,
31
   sectorFields: sectorFields.sectorFieldsReducer,
32
   regions: regions.regionSchoolsReducer,
33
   sectors: sectors.sectorCoursesReducer,
34
   studentDataFields: studentDataFields.studentDataFieldsReducer,
Open Source Developer's avatar
Open Source Developer committed
35
   epalclasses: epalclasses.epalclassesReducer,
Open Source Developer's avatar
Open Source Developer committed
36
   amkafills: amkafills.amkafillReducer,
37
   loginInfo: loginInfo.loginInfoReducer,
38
   criter: criter.criteriaReducer,
Open Source Developer's avatar
Open Source Developer committed
39
   
40 41 42 43
});

export function deimmutify(state: IAppState): Object {
  return {
44
    courseFields: courseFields.deimmutifyCourseFields(state.courseFields),
45
    sectorFields: sectorFields.deimmutifySectorFields(state.sectorFields),
46
    regions: regions.deimmutifyRegionSchools(state.regions),
47
    sectors: sectors.deimmutifySectorCourses(state.sectors),
48
    studentdataFields: studentDataFields.deimmutifyStudentDataFields(state.studentDataFields),
Open Source Developer's avatar
Open Source Developer committed
49
    epalclasses: epalclasses.deimmutifyEpalClasses(state.epalclasses),
Open Source Developer's avatar
Open Source Developer committed
50
    amkafills: amkafills.deimmutifyAmkaFills(state.amkafills),
51
    loginInfo: loginInfo.deimmutifyLoginInfo(state.loginInfo),
52
    criter: criter.deimmutifyCriteria(state.criter),
Open Source Developer's avatar
Open Source Developer committed
53
    
54 55
  };
}
Open Source Developer's avatar
Open Source Developer committed
56 57