pleroma/packages/pl-fe/src/store.ts

33 lines
808 B
TypeScript
Raw Normal View History

2023-12-20 20:06:49 -08:00
import { configureStore, Tuple } from '@reduxjs/toolkit';
import { thunk, type ThunkDispatch } from 'redux-thunk';
import errorsMiddleware from './middleware/errors';
import soundsMiddleware from './middleware/sounds';
import appReducer from './reducers';
import type { AnyAction } from 'redux';
const store = configureStore({
2022-04-25 10:43:13 -07:00
reducer: appReducer,
2023-12-20 20:06:49 -08:00
middleware: () => new Tuple(
2022-04-25 10:43:13 -07:00
thunk,
errorsMiddleware(),
2022-04-25 10:43:13 -07:00
soundsMiddleware(),
2023-12-20 20:06:49 -08:00
),
2022-04-25 10:43:13 -07:00
devTools: true,
});
type Store = typeof store;
2022-04-24 12:28:07 -07:00
// Infer the `RootState` and `AppDispatch` types from the store itself
// https://redux.js.org/usage/usage-with-typescript
type RootState = ReturnType<typeof store.getState>;
type AppDispatch = ThunkDispatch<RootState, {}, AnyAction>;
export {
store,
type Store,
type RootState,
type AppDispatch,
};