-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathstore.ts
66 lines (60 loc) · 1.8 KB
/
store.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import {
Action,
combineReducers,
configureStore,
createDynamicMiddleware,
Reducer,
ThunkDispatch
} from '@reduxjs/toolkit';
import addLayerModal from './addLayerModal';
import appInfo from './appInfo';
import description from './description';
import editFeature from './editFeature';
import editFeatureDrawerOpen from './editFeatureDrawerOpen';
import featureInfo from './featureInfo';
import layerDetailsModal from './layerDetailsModal';
import layerTree from './layerTree';
import legal from './legal';
import logoPath from './logoPath';
import print from './print';
import searchEngines from './searchEngines';
import selectedFeatures from './selectedFeatures';
import stylingDrawerLayerUid from './stylingDrawerLayerUid';
import stylingDrawerVisibility from './stylingDrawerVisibility';
import title from './title';
import toolMenu from './toolMenu';
import uploadDataModal from './uploadDataModal';
import user from './user';
type AsyncReducer = Record<string, Reducer>;
export const dynamicMiddleware = createDynamicMiddleware();
export const createReducer = (asyncReducers?: AsyncReducer) => {
return combineReducers({
addLayerModal,
appInfo,
description,
editFeature,
editFeatureDrawerOpen,
featureInfo,
layerDetailsModal,
layerTree,
legal,
logoPath,
print,
selectedFeatures,
title,
toolMenu,
uploadDataModal,
searchEngines,
user,
stylingDrawerVisibility,
stylingDrawerLayerUid,
...asyncReducers
});
};
export const store = configureStore({
reducer: createReducer(),
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().prepend(dynamicMiddleware.middleware)
});
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch & ThunkDispatch<RootState, undefined, Action>;