blob: 5f3841ed3c0d92422927670e1c926a7a79fba2e4 [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"
22301014bc4616f2025-06-03 16:59:44 +08003export const store = configureStore({
4 reducer: {
2230101462240ab2025-06-07 09:28:16 +08005 auth: authReducer,
6 },
7 middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(),
22301014bc4616f2025-06-03 16:59:44 +08008})
9
10// 从 store 本身推断出 `RootState` 和 `AppDispatch` 类型
11export type RootState = ReturnType<typeof store.getState>
12// 推断出类型: {posts: PostsState, comments: CommentsState, users: UsersState}
13export type AppDispatch = typeof store.dispatch