|
1 | | -import {createStore, applyMiddleware, compose} from 'redux' |
2 | | -import {composeWithDevTools} from 'redux-devtools-extension' |
| 1 | +import { createStore, applyMiddleware, compose } from 'redux' |
| 2 | +import { composeWithDevTools } from 'redux-devtools-extension' |
3 | 3 | import thunk from 'redux-thunk' |
4 | | -import {createWrapper} from "next-redux-wrapper"; |
5 | | -import {counter, initialState} from "../reducers"; |
| 4 | +import { createWrapper } from 'next-redux-wrapper' |
| 5 | +import { counter, initialState } from '../reducers' |
6 | 6 |
|
7 | | -const makeStore = context => { |
8 | | - let composeEnhancers = compose; |
| 7 | +const makeStore = () => { |
| 8 | + const composeEnhancers = process.env.NODE_ENV !== 'production' ? composeWithDevTools : compose |
9 | 9 |
|
10 | | -// If Redux Dev Tools and Saga Dev Tools Extensions are installed, enable them |
11 | | - if (process.env.NODE_ENV !== 'production' && typeof window === 'object') { |
12 | | - composeEnhancers = composeWithDevTools; |
13 | | - // NOTE: Uncomment the code below to restore support for Redux Saga |
14 | | - // Dev Tools once it supports redux-saga version 1.x.x |
15 | | - // if (window.__SAGA_MONITOR_EXTENSION__) |
16 | | - // reduxSagaMonitorOptions = { |
17 | | - // sagaMonitor: window.__SAGA_MONITOR_EXTENSION__, |
18 | | - // }; |
19 | | - } |
20 | | - return createStore( |
21 | | - counter, |
22 | | - initialState, |
23 | | - composeEnhancers(applyMiddleware(thunk)) |
24 | | - ) |
| 10 | + return createStore( |
| 11 | + counter, |
| 12 | + initialState, |
| 13 | + composeEnhancers(applyMiddleware(thunk)) |
| 14 | + ) |
25 | 15 | } |
26 | | -// create a makeStore function |
27 | | -// const makeStore = context => createStore(counter); |
28 | 16 |
|
29 | | - |
30 | | -// export an assembled wrapper |
31 | 17 | export default createWrapper(makeStore, {debug: true}) |
0 commit comments