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 | bc4616f | 2025-06-03 16:59:44 +0800 | [diff] [blame] | 3 | export const store = configureStore({ |
| 4 | reducer: { |
22301014 | 62240ab | 2025-06-07 09:28:16 +0800 | [diff] [blame^] | 5 | auth: authReducer, |
| 6 | }, |
| 7 | middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(), |
22301014 | bc4616f | 2025-06-03 16:59:44 +0800 | [diff] [blame] | 8 | }) |
| 9 | |
| 10 | // 从 store 本身推断出 `RootState` 和 `AppDispatch` 类型 |
| 11 | export type RootState = ReturnType<typeof store.getState> |
| 12 | // 推断出类型: {posts: PostsState, comments: CommentsState, users: UsersState} |
| 13 | export type AppDispatch = typeof store.dispatch |