Projekt

Obecné

Profil

Stáhnout (1.44 KB) Statistiky
| Větev: | Tag: | Revize:
1 37f6ff02 Vaclav Honzik
import { applyMiddleware, combineReducers, createStore } from 'redux'
2 a69da1e3 Vaclav Honzik
import { persistStore } from 'redux-persist'
3 37f6ff02 Vaclav Honzik
import thunk from 'redux-thunk'
4 8370b6c1 Vaclav Honzik
import userReducer from '../Auth/userSlice'
5 0d90d67b Vaclav Honzik
import themeReducer from '../Theme/themeSlice'
6 394f2d16 Vaclav Honzik
import catalogReducer from '../Catalog/catalogSlice'
7 1c710f4f Vaclav Honzik
import { composeWithDevTools } from 'redux-devtools-extension'
8 4f42fa52 Václav Honzík
import notificationReducer from '../Notification/notificationSlice'
9 8c57f958 Vaclav Honzik
import trackingToolReducer from '../TrackingTool/trackingToolSlice'
10
import { enableMapSet } from 'immer'
11 e9103a47 Vaclav Honzik
import navigationReducer from '../Navigation/navigationSlice'
12 8c57f958 Vaclav Honzik
13
enableMapSet()
14 c7d2ced1 Václav Honzík
15 1c710f4f Vaclav Honzik
const composeEnhancers = composeWithDevTools({})
16 8042e8b3 Vaclav Honzik
17 a69da1e3 Vaclav Honzik
// Store holds shared state in the application
18 c7d2ced1 Václav Honzík
const store = createStore(
19 1c710f4f Vaclav Honzik
    combineReducers({
20
        user: userReducer,
21
        theme: themeReducer,
22
        catalog: catalogReducer,
23 8c57f958 Vaclav Honzik
        notification: notificationReducer,
24 e9103a47 Vaclav Honzik
        trackingTool: trackingToolReducer,
25
        navigation: navigationReducer,
26 1c710f4f Vaclav Honzik
    }),
27
    process.env.REACT_APP_DEV_ENV === 'true'
28 e9103a47 Vaclav Honzik
        ? composeEnhancers(
29
              // ComposeEnhancers will inject redux-devtools-extension
30 1c710f4f Vaclav Honzik
              applyMiddleware(thunk) // Thunk middleware so we can async fetch data from the api
31
          )
32
        : applyMiddleware(thunk)
33 c7d2ced1 Václav Honzík
)
34
35
export default store
36 a69da1e3 Vaclav Honzik
export const persistor = persistStore(store)
37 c7d2ced1 Václav Honzík
export type AppStore = typeof store
38
export type RootState = ReturnType<typeof store.getState>
39
export type AppDispatch = typeof store.dispatch