2025-05-10 02:14:03 +08:00
|
|
|
import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
2025-05-09 10:18:49 +08:00
|
|
|
import creatorsReducer from './slices/creatorsSlice';
|
|
|
|
import filtersReducer from './slices/filtersSlice';
|
2025-05-10 02:14:03 +08:00
|
|
|
import brandsReducer from './slices/brandsSlice';
|
|
|
|
import { persistReducer, persistStore } from 'redux-persist';
|
|
|
|
import sessionStorage from 'redux-persist/es/storage/session';
|
|
|
|
import inboxReducer from './slices/inboxSlice';
|
2025-05-15 10:42:39 +08:00
|
|
|
import authReducer from './slices/authSlice';
|
|
|
|
import discoveryReducer from './slices/discoverySlice';
|
|
|
|
|
2025-05-10 02:14:03 +08:00
|
|
|
const reducers = combineReducers({
|
|
|
|
creators: creatorsReducer,
|
|
|
|
filters: filtersReducer,
|
|
|
|
brands: brandsReducer,
|
|
|
|
inbox: inboxReducer,
|
2025-05-15 10:42:39 +08:00
|
|
|
auth: authReducer,
|
|
|
|
discovery: discoveryReducer,
|
2025-05-10 02:14:03 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
const persistConfig = {
|
|
|
|
key: 'root',
|
|
|
|
storage: sessionStorage,
|
|
|
|
};
|
2025-05-09 10:18:49 +08:00
|
|
|
|
2025-05-10 02:14:03 +08:00
|
|
|
const persistedReducer = persistReducer(persistConfig, reducers);
|
|
|
|
|
|
|
|
const store = configureStore({
|
|
|
|
reducer: persistedReducer,
|
2025-05-09 10:18:49 +08:00
|
|
|
middleware: (getDefaultMiddleware) =>
|
|
|
|
getDefaultMiddleware({
|
|
|
|
serializableCheck: false,
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
|
2025-05-10 02:14:03 +08:00
|
|
|
export const persistor = persistStore(store);
|
|
|
|
|
2025-05-09 10:18:49 +08:00
|
|
|
export default store;
|