blob: cb5b975a8db4677f9165f2c83315de4989bddabc [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"
223010144ce05872025-06-08 22:33:28 +08004import workReducer from "../feature/work/workSlice"
5
22301014bc4616f2025-06-03 16:59:44 +08006export const store = configureStore({
7 reducer: {
2230101462240ab2025-06-07 09:28:16 +08008 auth: authReducer,
22301014b1477f72025-06-07 22:54:40 +08009 user: userReducer,
223010144ce05872025-06-08 22:33:28 +080010 work: workReducer,
2230101462240ab2025-06-07 09:28:16 +080011 },
12 middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(),
22301014bc4616f2025-06-03 16:59:44 +080013})
14
15// 从 store 本身推断出 `RootState` 和 `AppDispatch` 类型
16export type RootState = ReturnType<typeof store.getState>
17// 推断出类型: {posts: PostsState, comments: CommentsState, users: UsersState}
18export type AppDispatch = typeof store.dispatch