You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
721 B
TypeScript

import { combineReducers, configureStore } from '@reduxjs/toolkit'
import { networkApi, type NetworkApi } from './network'
import { shop, auth, user } from './storage'
const reducer = combineReducers({
[auth.name]: auth.reducer,
[shop.name]: shop.reducer,
[user.name]: user.reducer,
})
export const store = configureStore({
reducer,
middleware: getDefaultMiddleware =>
getDefaultMiddleware({
thunk: {
extraArgument: networkApi,
},
}),
})
export type RootState = ReturnType<typeof store.getState>
export type AppDispatch = typeof store.dispatch
export type ThunkApi = {
dispatch: AppDispatch
state: RootState
extra: NetworkApi
}