22301014 | bc4616f | 2025-06-03 16:59:44 +0800 | [diff] [blame] | 1 | import { configureStore } from '@reduxjs/toolkit' |
22301014 | 62240ab | 2025-06-07 09:28:16 +0800 | [diff] [blame] | 2 | import authReducer from "../feature/auth/authSlice" |
22301014 | b1477f7 | 2025-06-07 22:54:40 +0800 | [diff] [blame] | 3 | import userReducer from "../feature/user/userSlice" |
22301014 | 4ce0587 | 2025-06-08 22:33:28 +0800 | [diff] [blame] | 4 | import workReducer from "../feature/work/workSlice" |
22301014 | 356527a | 2025-06-09 17:46:56 +0800 | [diff] [blame^] | 5 | import workListReducer from '../feature/home/workListSlice'; |
| 6 | import categoryReducer from '../feature/home/categorySlice'; |
22301014 | bc4616f | 2025-06-03 16:59:44 +0800 | [diff] [blame] | 7 | export const store = configureStore({ |
| 8 | reducer: { |
22301014 | 62240ab | 2025-06-07 09:28:16 +0800 | [diff] [blame] | 9 | auth: authReducer, |
22301014 | b1477f7 | 2025-06-07 22:54:40 +0800 | [diff] [blame] | 10 | user: userReducer, |
22301014 | 4ce0587 | 2025-06-08 22:33:28 +0800 | [diff] [blame] | 11 | work: workReducer, |
22301014 | 356527a | 2025-06-09 17:46:56 +0800 | [diff] [blame^] | 12 | workList: workListReducer, |
| 13 | category: categoryReducer, |
22301014 | 62240ab | 2025-06-07 09:28:16 +0800 | [diff] [blame] | 14 | }, |
| 15 | middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(), |
22301014 | bc4616f | 2025-06-03 16:59:44 +0800 | [diff] [blame] | 16 | }) |
| 17 | |
| 18 | // 从 store 本身推断出 `RootState` 和 `AppDispatch` 类型 |
| 19 | export type RootState = ReturnType<typeof store.getState> |
| 20 | // 推断出类型: {posts: PostsState, comments: CommentsState, users: UsersState} |
| 21 | export type AppDispatch = typeof store.dispatch |