2022-04-25 10:43:13 -07:00
|
|
|
import { configureStore } from '@reduxjs/toolkit';
|
|
|
|
import { AnyAction } from 'redux';
|
2022-03-18 14:04:08 -07:00
|
|
|
import thunk, { ThunkDispatch } from 'redux-thunk';
|
2022-03-14 16:01:09 -07:00
|
|
|
|
|
|
|
import errorsMiddleware from './middleware/errors';
|
|
|
|
import soundsMiddleware from './middleware/sounds';
|
|
|
|
import appReducer from './reducers';
|
|
|
|
|
2022-04-25 10:43:13 -07:00
|
|
|
export const store = configureStore({
|
|
|
|
reducer: appReducer,
|
|
|
|
middleware: [
|
|
|
|
thunk,
|
|
|
|
errorsMiddleware(),
|
|
|
|
soundsMiddleware(),
|
|
|
|
],
|
|
|
|
devTools: true,
|
|
|
|
});
|
2022-03-14 16:01:09 -07:00
|
|
|
|
2022-04-24 12:28:07 -07:00
|
|
|
export type Store = typeof store;
|
|
|
|
|
2022-03-14 16:01:09 -07:00
|
|
|
// 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>;
|
2022-03-18 14:04:08 -07:00
|
|
|
export type AppDispatch = ThunkDispatch<{}, {}, AnyAction>;
|