blob: 49212188bdf14a95f835644148b74323378f16a6 [file] [log] [blame]
22301014bc4616f2025-06-03 16:59:44 +08001import { configureStore } from '@reduxjs/toolkit'
2230101462240ab2025-06-07 09:28:16 +08002import authReducer from "../feature/auth/authSlice"
22301014b1477f72025-06-07 22:54:40 +08003import userReducer from "../feature/user/userSlice"
22301014bc4616f2025-06-03 16:59:44 +08004export const store = configureStore({
5 reducer: {
2230101462240ab2025-06-07 09:28:16 +08006 auth: authReducer,
22301014b1477f72025-06-07 22:54:40 +08007 user: userReducer,
2230101462240ab2025-06-07 09:28:16 +08008 },
9 middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(),
22301014bc4616f2025-06-03 16:59:44 +080010})
11
12// 从 store 本身推断出 `RootState` 和 `AppDispatch` 类型
13export type RootState = ReturnType<typeof store.getState>
14// 推断出类型: {posts: PostsState, comments: CommentsState, users: UsersState}
15export type AppDispatch = typeof store.dispatch