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