Configured redux dev tools

This commit is contained in:
Alejandro Celaya 2018-08-05 08:13:12 +02:00
parent 3c0f1716aa
commit 9575107848
3 changed files with 9 additions and 4 deletions

View file

@ -3,7 +3,7 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom'; import { BrowserRouter } from 'react-router-dom';
import { applyMiddleware, createStore } from 'redux'; import { applyMiddleware, compose, createStore } from 'redux';
import ReduxThunk from 'redux-thunk'; import ReduxThunk from 'redux-thunk';
import App from './App'; import App from './App';
@ -11,7 +11,12 @@ import './index.scss';
import reducers from './reducers'; import reducers from './reducers';
import registerServiceWorker from './registerServiceWorker'; import registerServiceWorker from './registerServiceWorker';
const store = createStore(reducers, applyMiddleware(ReduxThunk)); const composeEnhancers = process.env.NODE_ENV !== 'production' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
: compose;
const store = createStore(reducers, composeEnhancers(
applyMiddleware(ReduxThunk)
));
ReactDOM.render( ReactDOM.render(
<Provider store={store}> <Provider store={store}>

View file

@ -5,7 +5,7 @@ const LIST_SHORT_URLS_ERROR = 'shlink/shortUrlsList/LIST_SHORT_URLS_ERROR';
export const LIST_SHORT_URLS = 'shlink/shortUrlsList/LIST_SHORT_URLS'; export const LIST_SHORT_URLS = 'shlink/shortUrlsList/LIST_SHORT_URLS';
const initialState = { const initialState = {
shortUrls: [], shortUrls: {},
loading: true, loading: true,
}; };

View file

@ -2,7 +2,7 @@ import { LIST_SHORT_URLS } from './shortUrlsList';
const RESET_SHORT_URL_PARAMS = 'shlink/shortUrlsListParams/RESET_SHORT_URL_PARAMS'; const RESET_SHORT_URL_PARAMS = 'shlink/shortUrlsListParams/RESET_SHORT_URL_PARAMS';
const defaultState = { page: 1 }; const defaultState = { page: '1' };
export default function reducer(state = defaultState, action) { export default function reducer(state = defaultState, action) {
switch (action.type) { switch (action.type) {