modmapper-web/lib/store.ts

32 lines
978 B
TypeScript
Raw Normal View History

2022-08-29 05:19:01 +00:00
import LogRocket from "logrocket"
2022-08-30 03:47:15 +00:00
import * as Sentry from "@sentry/react";
2022-08-30 02:37:13 +00:00
import { configureStore, ThunkAction, Action } from "@reduxjs/toolkit"
2022-02-27 06:17:52 +00:00
import pluginsReducer from "../slices/plugins"
import pluginsTxtReducer from "../slices/pluginsTxt"
import modListFiltersReducer from "../slices/modListFilters"
2022-02-27 06:17:52 +00:00
2022-08-30 03:47:15 +00:00
const sentryReduxEnhancer = Sentry.createReduxEnhancer();
2022-02-27 06:17:52 +00:00
export function makeStore() {
return configureStore({
reducer: { pluginsTxt: pluginsTxtReducer, plugins: pluginsReducer, modListFilters: modListFiltersReducer },
2022-08-29 05:19:01 +00:00
middleware: (getDefaultMiddleware) => getDefaultMiddleware({ serializableCheck: false }).concat(LogRocket.reduxMiddleware()),
2022-08-30 03:47:15 +00:00
enhancers: [sentryReduxEnhancer],
2022-02-27 06:17:52 +00:00
})
}
const store = makeStore()
export type AppState = ReturnType<typeof store.getState>
export type AppDispatch = typeof store.dispatch
export type AppThunk<ReturnType = void> = ThunkAction<
ReturnType,
AppState,
unknown,
Action<string>
>
export default store