Projekt

Obecné

Profil

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