24 lines
737 B
TypeScript
24 lines
737 B
TypeScript
import { configureStore } from "@reduxjs/toolkit";
|
|
import advancedSearchReducer from "./advanedSearch/advancedSearchSlice";
|
|
import authReducer from "./auth/authSlice";
|
|
|
|
export const makeStore = () => {
|
|
return configureStore({
|
|
reducer: {
|
|
advancedSearch: advancedSearchReducer,
|
|
auth: authReducer,
|
|
},
|
|
// Enable Redux DevTools
|
|
devTools: process.env.NODE_ENV !== "production",
|
|
});
|
|
};
|
|
|
|
// Create the store instance
|
|
export const store = makeStore();
|
|
|
|
// Infer the type of makeStore
|
|
export type AppStore = ReturnType<typeof makeStore>;
|
|
// Infer the `RootState` and `AppDispatch` types from the store itself
|
|
export type RootState = ReturnType<AppStore["getState"]>;
|
|
export type AppDispatch = AppStore["dispatch"];
|