store.ts 1.48 KB
Newer Older
1
2
3
4
5
6
7
import { combineReducers } from "redux";
import * as sectorFields from "./sectorfields";
import * as regions from "./regionschools";
import * as sectors from "./sectorcourses";
import * as studentDataFields from "./studentdatafields";
import * as epalclasses from "./epalclasses";
import * as loginInfo from "./logininfo";
8
9

export interface IAppState {
10
    sectorFields?: sectorFields.ISectorFieldRecords;
11
    regions?: regions.IRegionRecords;
12
    sectors?: sectors.ISectors;
13
    studentDataFields?: studentDataFields.IStudentDataFieldRecords;
Open Source Developer's avatar
Open Source Developer committed
14
    epalclasses?: epalclasses.IEpalClasses;
15
    loginInfo?: loginInfo.ILoginInfo;
16
17
18
};

export const rootReducer = combineReducers<IAppState>({
19
20
21
22
23
24
    sectorFields: sectorFields.sectorFieldsReducer,
    regions: regions.regionSchoolsReducer,
    sectors: sectors.sectorCoursesReducer,
    studentDataFields: studentDataFields.studentDataFieldsReducer,
    epalclasses: epalclasses.epalclassesReducer,
    loginInfo: loginInfo.loginInfoReducer,
25
26
27
});

export function deimmutify(state: IAppState): Object {
28
29
30
31
32
33
34
35
    return {
        sectorFields: sectorFields.deimmutifySectorFields(state.sectorFields),
        regions: regions.deimmutifyRegionSchools(state.regions),
        sectors: sectors.deimmutifySectorCourses(state.sectors),
        studentdataFields: studentDataFields.deimmutifyStudentDataFields(state.studentDataFields),
        epalclasses: epalclasses.deimmutifyEpalClasses(state.epalclasses),
        loginInfo: loginInfo.deimmutifyLoginInfo(state.loginInfo),
    };
36
}