-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore.ts
29 lines (24 loc) · 1.08 KB
/
store.ts
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
import { Action, combineReducers, configureStore } from "@reduxjs/toolkit";
import { combineEpics, createEpicMiddleware } from "redux-observable";
import { authEpic, authSlice } from "./auth";
import { colorConfigEpic, colorConfigSlice } from "./colorConfig";
import {
notificationsListEpic,
notificationsListSlice,
} from "./notificationsList";
const rootReducer = combineReducers({
[authSlice.name]: authSlice.reducer,
[notificationsListSlice.name]: notificationsListSlice.reducer,
[colorConfigSlice.name]: colorConfigSlice.reducer,
});
export type RootState = ReturnType<typeof rootReducer>;
// TODO: Fix typing of AppDispatch so that it isn't "AnyAction"
export type AppDispatch = typeof store.dispatch;
const epicMiddleware = createEpicMiddleware<Action, Action, RootState>();
export const store = configureStore({
reducer: rootReducer,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({ thunk: false, serializableCheck: false }).concat(epicMiddleware),
});
const rootEpic = combineEpics(colorConfigEpic, authEpic, notificationsListEpic);
epicMiddleware.run(rootEpic);