soapbox/src/store.ts

26 lines
735 B
TypeScript
Raw Permalink Normal View History

2022-04-25 19:43:13 +02:00
import { configureStore } from '@reduxjs/toolkit';
2022-03-18 22:04:08 +01:00
import thunk, { ThunkDispatch } from 'redux-thunk';
import errorsMiddleware from './middleware/errors';
import soundsMiddleware from './middleware/sounds';
import appReducer from './reducers';
import type { AnyAction } from 'redux';
2022-04-25 19:43:13 +02:00
export const store = configureStore({
reducer: appReducer,
middleware: [
thunk,
errorsMiddleware(),
2022-04-25 19:43:13 +02:00
soundsMiddleware(),
],
devTools: true,
});
2022-04-24 21:28:07 +02:00
export type Store = typeof store;
// Infer the `RootState` and `AppDispatch` types from the store itself
// https://redux.js.org/usage/usage-with-typescript
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = ThunkDispatch<RootState, {}, AnyAction>;