Projekt

Obecné

Profil

Stáhnout (1.44 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 { enableMapSet } from 'immer'
11
import navigationReducer from '../Navigation/navigationSlice'
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
        navigation: navigationReducer,
26
    }),
27
    process.env.REACT_APP_DEV_ENV === 'true'
28
        ? composeEnhancers(
29
              // ComposeEnhancers will inject redux-devtools-extension
30
              applyMiddleware(thunk) // Thunk middleware so we can async fetch data from the api
31
          )
32
        : applyMiddleware(thunk)
33
)
34

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