Revize a69da1e3
Přidáno uživatelem Václav Honzík před více než 2 roky(ů)
frontend/src/features/redux/store.ts | ||
---|---|---|
1 |
// Store that holds the state of the application |
|
2 | 1 |
|
3 | 2 |
import { combineReducers, createStore } from 'redux' |
4 |
import authReducer from '../Auth/authReducer' |
|
3 |
import { persistStore } from 'redux-persist' |
|
4 |
import userReducer from '../Auth/userReducer' |
|
5 | 5 |
import themeReducer from '../Theme/themeReducer' |
6 | 6 |
|
7 |
// Store holds shared state in the application |
|
7 | 8 |
const store = createStore( |
8 |
combineReducers({ auth: authReducer, theme: themeReducer }),
|
|
9 |
combineReducers({ user: userReducer, theme: themeReducer }),
|
|
9 | 10 |
{} |
10 | 11 |
) |
11 | 12 |
|
12 | 13 |
export default store |
13 |
|
|
14 |
export const persistor = persistStore(store) |
|
14 | 15 |
export type AppStore = typeof store |
15 |
|
|
16 | 16 |
export type RootState = ReturnType<typeof store.getState> |
17 |
|
|
18 | 17 |
export type AppDispatch = typeof store.dispatch |
Také k dispozici: Unified diff
re #9367 - redux-persist for data persistence