| 1234567891011121314151617181920212223242526272829303132333435 |
- import { configureStore } from "@reduxjs/toolkit";
- import cartSlice, {CartState} from "./slices/cart-slice";
- import addToCartDialogReducer from "./slices/addToCartDialogSlice";
- // export const store = configureStore({
- // reducer: {
- // cartDetail: cartSlice,
- // user: userSlice,
- // addToCartDialog: addToCartDialogReducer,
- // currencyList: currencySlice
- // },
- // });
- // export type RootState = ReturnType<typeof store.getState>;
- // export type AppDispatch = typeof store.dispatch;
- export interface PreloadedStateType {
- cartDetail: CartState;
- }
- export const makeStore = (preloadedState: PreloadedStateType) => {
- return configureStore({
- reducer: {
- cartDetail: cartSlice,
- addToCartDialog: addToCartDialogReducer,
- },
- preloadedState
- });
- }
- // 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']
|