Projekt

Obecné

Profil

Stáhnout (1.43 KB) Statistiky
| Větev: | Tag: | Revize:
1
import { applyMiddleware, combineReducers, createStore } from 'redux'
2
import { persistStore } from 'redux-persist'
3
import thunk from 'redux-thunk'
4
import userReducer from '../Auth/userSlice'
5
import themeReducer from '../Theme/themeSlice'
6
import catalogReducer from '../Catalog/catalogSlice'
7
import { composeWithDevTools } from 'redux-devtools-extension'
8
import notificationReducer from '../Notification/notificationSlice'
9
import trackingToolReducer from '../TrackingTool/trackingToolSlice'
10
import usersDetailReducer from '../Administration/userDetailSlice'
11
import { enableMapSet } from 'immer'
12

    
13
enableMapSet()
14

    
15
const composeEnhancers = composeWithDevTools({})
16

    
17
// Store holds shared state in the application
18
const store = createStore(
19
    combineReducers({
20
        user: userReducer,
21
        theme: themeReducer,
22
        catalog: catalogReducer,
23
        notification: notificationReducer,
24
        trackingTool: trackingToolReducer,
25
        usersDetail: usersDetailReducer,
26
    }),
27
    process.env.REACT_APP_DEV_ENV === 'true'
28
        ? composeEnhancers( // ComposeEnhancers will inject redux-devtools-extension
29
              applyMiddleware(thunk) // Thunk middleware so we can async fetch data from the api
30
          )
31
        : applyMiddleware(thunk)
32
)
33

    
34
export default store
35
export const persistor = persistStore(store)
36
export type AppStore = typeof store
37
export type RootState = ReturnType<typeof store.getState>
38
export type AppDispatch = typeof store.dispatch
    (1-1/1)