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