mirror of
https://github.com/Funkoala14/knowledgebase_influencer.git
synced 2025-06-08 11:18:14 +08:00
42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
import { persistReducer, persistStore } from 'redux-persist';
|
|
import sessionStorage from 'redux-persist/lib/storage/session';
|
|
import notificationReducer from './notification.slice.js';
|
|
import authReducer from './auth/auth.slice.js';
|
|
import knowledgeBaseReducer from './knowledgeBase/knowledgeBase.slice.js';
|
|
import chatReducer from './chat/chat.slice.js';
|
|
import permissionsReducer from './permissions/permissions.slice.js';
|
|
import notificationCenterReducer from './notificationCenter/notificationCenter.slice.js';
|
|
|
|
const rootRducer = combineReducers({
|
|
auth: authReducer,
|
|
notification: notificationReducer,
|
|
knowledgeBase: knowledgeBaseReducer,
|
|
chat: chatReducer,
|
|
permissions: permissionsReducer,
|
|
notificationCenter: notificationCenterReducer,
|
|
});
|
|
|
|
const persistConfig = {
|
|
key: 'root',
|
|
storage: sessionStorage,
|
|
whitelist: ['auth'],
|
|
};
|
|
|
|
// Persist configuration
|
|
const persistedReducer = persistReducer(persistConfig, rootRducer);
|
|
|
|
const store = configureStore({
|
|
reducer: persistedReducer,
|
|
middleware: (getDefaultMiddleware) =>
|
|
getDefaultMiddleware({
|
|
serializableCheck: false, // Disable serializable check for redux-persist
|
|
}),
|
|
devTools: true,
|
|
});
|
|
|
|
// Create the persistor to manage rehydrating the store
|
|
export const persistor = persistStore(store);
|
|
|
|
export default store;
|