Projekt

Obecné

Profil

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