refactor: use redux-devtools-extension package (#4805)

This commit is contained in:
Vladislav Shkodin
2021-01-05 16:51:06 +02:00
committed by GitHub
parent 4687fd65c1
commit 0707de502c
3 changed files with 24 additions and 14 deletions

View File

@ -61,6 +61,7 @@
"react-waypoint": "^9.0.3",
"react-window": "^1.8.5",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-notifications": "^4.0.1",
"redux-thunk": "^2.3.0",
"sanitize-filename": "^1.6.1",

View File

@ -1,4 +1,5 @@
import { createStore, applyMiddleware, compose, AnyAction } from 'redux';
import { createStore, applyMiddleware, AnyAction } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunkMiddleware, { ThunkMiddleware } from 'redux-thunk';
import { routerMiddleware } from 'connected-react-router';
import { waitUntilAction } from './middleware/waitUntilAction';
@ -7,23 +8,14 @@ import history from '../routing/history';
import { State } from '../types/redux';
import { Reducer } from 'react';
declare global {
interface Window {
__REDUX_DEVTOOLS_EXTENSION__?: Function;
}
}
const store = createStore<State | undefined, AnyAction, unknown, unknown>(
(createRootReducer(history) as unknown) as Reducer<State | undefined, AnyAction>,
compose(
composeWithDevTools(
applyMiddleware(
routerMiddleware(history),
thunkMiddleware as ThunkMiddleware<State, AnyAction>,
waitUntilAction,
),
window.__REDUX_DEVTOOLS_EXTENSION__
? window.__REDUX_DEVTOOLS_EXTENSION__()
: (f: Function): Function => f,
),
);