Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Place store configuration into a single file
Browse files Browse the repository at this point in the history
  • Loading branch information
June Domingo committed Nov 6, 2016
1 parent fdb12c8 commit 08e107c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 30 deletions.
15 changes: 0 additions & 15 deletions src/store/configureStore.dev.js

This file was deleted.

27 changes: 23 additions & 4 deletions src/store/configureStore.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
if (process.env.NODE_ENV === "production" || (location && location.hostname !== 'localhost')) {
module.exports = require('./configureStore.prod');
/* eslint-disable global-require */
import { createStore, applyMiddleware } from 'redux';
import rootReducer from '../reducers/rootReducer';
import thunk from 'redux-thunk';

let middleware = [thunk];

if (process.env.NODE_ENV !== 'production') {
const reduxImmutableStateInvariant = require('redux-immutable-state-invariant')();
const createLogger = require('redux-logger');

const logger = createLogger({ collapsed: true });
middleware = [...middleware, reduxImmutableStateInvariant, logger];
} else {
module.exports = require('./configureStore.dev');
}
middleware = [...middleware];
}

export default function configureStore(initialState) {
return createStore(
rootReducer,
initialState,
applyMiddleware(...middleware)
);
}
11 changes: 0 additions & 11 deletions src/store/configureStore.prod.js

This file was deleted.

0 comments on commit 08e107c

Please sign in to comment.