40 lines
1.7 KiB
JavaScript
40 lines
1.7 KiB
JavaScript
// src/store/index.js
|
|
import { configureStore } from '@reduxjs/toolkit';
|
|
import communityDataReducer from './slices/communityDataSlice';
|
|
import posthogReducer from './slices/posthogSlice';
|
|
import industryReducer from './slices/industrySlice';
|
|
import stockReducer from './slices/stockSlice';
|
|
import authModalReducer from './slices/authModalSlice';
|
|
import subscriptionReducer from './slices/subscriptionSlice';
|
|
import posthogMiddleware from './middleware/posthogMiddleware';
|
|
import { eventsApi } from './api/eventsApi'; // ✅ RTK Query API
|
|
|
|
export const store = configureStore({
|
|
reducer: {
|
|
communityData: communityDataReducer,
|
|
posthog: posthogReducer, // ✅ PostHog Redux 状态管理
|
|
industry: industryReducer, // ✅ 行业分类数据管理
|
|
stock: stockReducer, // ✅ 股票和事件数据管理
|
|
authModal: authModalReducer, // ✅ 认证弹窗状态管理
|
|
subscription: subscriptionReducer, // ✅ 订阅信息状态管理
|
|
[eventsApi.reducerPath]: eventsApi.reducer, // ✅ RTK Query 事件 API
|
|
},
|
|
middleware: (getDefaultMiddleware) =>
|
|
getDefaultMiddleware({
|
|
serializableCheck: {
|
|
// 忽略这些 action types 的序列化检查
|
|
ignoredActions: [
|
|
'communityData/fetchPopularKeywords/fulfilled',
|
|
'communityData/fetchHotEvents/fulfilled',
|
|
'posthog/trackEvent/fulfilled', // ✅ PostHog 事件追踪
|
|
'stock/fetchEventStocks/fulfilled',
|
|
'stock/fetchStockQuotes/fulfilled',
|
|
],
|
|
},
|
|
})
|
|
.concat(posthogMiddleware) // ✅ PostHog 自动追踪中间件
|
|
.concat(eventsApi.middleware), // ✅ RTK Query 中间件(自动缓存、去重、重试)
|
|
});
|
|
|
|
export default store;
|