blob: b543f755a9d4d9f488a7ea4016c7fd97fef1bed3 [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"
22301014356527a2025-06-09 17:46:56 +08005import workListReducer from '../feature/home/workListSlice';
6import categoryReducer from '../feature/home/categorySlice';
22301014bc4616f2025-06-03 16:59:44 +08007export const store = configureStore({
8 reducer: {
2230101462240ab2025-06-07 09:28:16 +08009 auth: authReducer,
22301014b1477f72025-06-07 22:54:40 +080010 user: userReducer,
223010144ce05872025-06-08 22:33:28 +080011 work: workReducer,
22301014356527a2025-06-09 17:46:56 +080012 workList: workListReducer,
13 category: categoryReducer,
2230101462240ab2025-06-07 09:28:16 +080014 },
15 middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(),
22301014bc4616f2025-06-03 16:59:44 +080016})
17
18// 从 store 本身推断出 `RootState` 和 `AppDispatch` 类型
19export type RootState = ReturnType<typeof store.getState>
20// 推断出类型: {posts: PostsState, comments: CommentsState, users: UsersState}
21export type AppDispatch = typeof store.dispatch