store.ts 1.72 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
10
11
12
13
14
15

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

export interface IAppState {
    courseFields?: courseFields.ICourseFields;
16
    sectorFields?: sectorFields.ISectorFields;
17
    regions?: regions.IRegions;
18
    sectors?: sectors.ISectors;
19
    studentDataFields?: studentDataFields.IStudentDataFields;
Open Source Developer's avatar
Open Source Developer committed
20
    epalclasses?: epalclasses.IEpalClasses;
Open Source Developer's avatar
Open Source Developer committed
21
    amkafills?: amkafills.IAmkaFills;    
22
23
24
25
};

export const rootReducer = combineReducers<IAppState>({
   courseFields: courseFields.courseFieldsReducer,
26
   sectorFields: sectorFields.sectorFieldsReducer,
27
   regions: regions.regionSchoolsReducer,
28
   sectors: sectors.sectorCoursesReducer,
29
   studentDataFields: studentDataFields.studentDataFieldsReducer,
Open Source Developer's avatar
Open Source Developer committed
30
   epalclasses: epalclasses.epalclassesReducer,
Open Source Developer's avatar
Open Source Developer committed
31
   amkafills: amkafills.amkafillReducer,
32
33
34
35
});

export function deimmutify(state: IAppState): Object {
  return {
36
    courseFields: courseFields.deimmutifyCourseFields(state.courseFields),
37
    sectorFields: sectorFields.deimmutifySectorFields(state.sectorFields),
38
    regions: regions.deimmutifyRegionSchools(state.regions),
39
    sectors: sectors.deimmutifySectorCourses(state.sectors),
40
    studentdataFields: studentDataFields.deimmutifyStudentDataFields(state.studentDataFields),
Open Source Developer's avatar
Open Source Developer committed
41
    epalclasses: epalclasses.deimmutifyEpalClasses(state.epalclasses),
Open Source Developer's avatar
Open Source Developer committed
42
    amkafills: amkafills.deimmutifyAmkaFills(state.amkafills),
43
44
  };
}