store.ts 1.9 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
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.IRegions;
19
    sectors?: sectors.ISectors;
20
    studentDataFields?: studentDataFields.IStudentDataFields;
Open Source Developer's avatar
Open Source Developer committed
21
    epalclasses?: epalclasses.IEpalClasses;
22
23
    amkafills?: amkafills.IAmkaFills;
    loginInfo?: loginInfo.ILoginInfo;
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,
Open Source Developer's avatar
Open Source Developer committed
33
   amkafills: amkafills.amkafillReducer,
34
   loginInfo: loginInfo.loginInfoReducer,
35
36
37
38
});

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