Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 33x 33x 33x | import { configureStore } from "@reduxjs/toolkit";
import { enhancedAPI } from "../api/enhanceEndpoints.ts";
import { setupListeners } from "@reduxjs/toolkit/query";
import pointerReducer from "./PointerSlice.ts";
import detectClickReducer from "./ClickSlice.ts";
import copySliceReducer from "./CopySlice.ts";
import hoverReducer from "./ObjectHoverSlice.ts";
import uiReducer from "./uiSlice.ts";
// See also: https://redux-toolkit.js.org/tutorials/typescript
export const store = configureStore({
reducer: {
// API is handled by redux reducers: https://redux-toolkit.js.org/tutorials/rtk-query
[enhancedAPI.reducerPath]: enhancedAPI.reducer,
pointer: pointerReducer,
click: detectClickReducer,
copiedObject: copySliceReducer,
hover: hoverReducer,
ui: uiReducer,
},
// Adding the api middleware enables caching, invalidation, polling,
// and other useful features of `rtk-query`.
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().concat(enhancedAPI.middleware),
});
// optional, but required for refetchOnFocus/refetchOnReconnect behaviors
// see `setupListeners` docs - takes an optional callback as the 2nd arg for customization
setupListeners(store.dispatch);
// Infer the `RootState` and `AppDispatch` types from the store itself
export type RootState = ReturnType<typeof store.getState>;
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch;
|