mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-13 01:07:42 -05:00
20 lines
626 B
JavaScript
20 lines
626 B
JavaScript
import { configureStore } from '@reduxjs/toolkit'
|
|
import { userReducer } from '../features/user/userSlice'
|
|
import { apiSlice } from "../features/api/apiSlice"
|
|
|
|
const setupStore = (preloadedState) => {
|
|
const store = configureStore({
|
|
reducer: {
|
|
user: userReducer,
|
|
[apiSlice.reducerPath]: apiSlice.reducer,
|
|
},
|
|
middleware: (getDefaultMiddleware) =>
|
|
// adding the api middleware enables caching, invalidation, polling and other features of `rtk-query`
|
|
getDefaultMiddleware().concat(apiSlice.middleware),
|
|
preloadedState,
|
|
})
|
|
|
|
return store
|
|
}
|
|
|
|
export default setupStore; |