Projekt

Obecné

Profil

Stáhnout (1.7 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 287652cf Schwobik
import usersDetailReducer from '../Administration/userDetailSlice'
11 8c57f958 Vaclav Honzik
import { enableMapSet } from 'immer'
12 e9103a47 Vaclav Honzik
import navigationReducer from '../Navigation/navigationSlice'
13 6187bffd Schwobik
import catalogItemReducer from "../Catalog/catalogItemSlice"
14 8c57f958 Vaclav Honzik
15
enableMapSet()
16 c7d2ced1 Václav Honzík
17 1c710f4f Vaclav Honzik
const composeEnhancers = composeWithDevTools({})
18 8042e8b3 Vaclav Honzik
19 558a15d4 Vaclav Honzik
// Store holds shared state in the application to remove the need for passing state to every component
20 c7d2ced1 Václav Honzík
const store = createStore(
21 1c710f4f Vaclav Honzik
    combineReducers({
22
        user: userReducer,
23
        theme: themeReducer,
24
        catalog: catalogReducer,
25 8c57f958 Vaclav Honzik
        notification: notificationReducer,
26 e9103a47 Vaclav Honzik
        trackingTool: trackingToolReducer,
27 287652cf Schwobik
        usersDetail: usersDetailReducer,
28 6187bffd Schwobik
        catalogItem: catalogItemReducer,
29 e9103a47 Vaclav Honzik
        navigation: navigationReducer,
30 1c710f4f Vaclav Honzik
    }),
31
    process.env.REACT_APP_DEV_ENV === 'true'
32 e9103a47 Vaclav Honzik
        ? composeEnhancers(
33
              // ComposeEnhancers will inject redux-devtools-extension
34 1c710f4f Vaclav Honzik
              applyMiddleware(thunk) // Thunk middleware so we can async fetch data from the api
35
          )
36
        : applyMiddleware(thunk)
37 c7d2ced1 Václav Honzík
)
38
39
export default store
40 a69da1e3 Vaclav Honzik
export const persistor = persistStore(store)
41 c7d2ced1 Václav Honzík
export type AppStore = typeof store
42
export type RootState = ReturnType<typeof store.getState>
43
export type AppDispatch = typeof store.dispatch