feat: 添加 RTK Query 集成用于事件数据获取(实验性)...

This commit is contained in:
zdl
2025-11-06 01:25:44 +08:00
parent 273ff5f72d
commit 31e5a4ee48
2 changed files with 149 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ 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: {
@@ -16,6 +17,7 @@ export const store = configureStore({
stock: stockReducer, // ✅ 股票和事件数据管理
authModal: authModalReducer, // ✅ 认证弹窗状态管理
subscription: subscriptionReducer, // ✅ 订阅信息状态管理
[eventsApi.reducerPath]: eventsApi.reducer, // ✅ RTK Query 事件 API
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
@@ -29,7 +31,9 @@ export const store = configureStore({
'stock/fetchStockQuotes/fulfilled',
],
},
}).concat(posthogMiddleware), // ✅ PostHog 自动追踪中间件
})
.concat(posthogMiddleware) // ✅ PostHog 自动追踪中间件
.concat(eventsApi.middleware), // ✅ RTK Query 中间件(自动缓存、去重、重试)
});
export default store;