This repository has been archived by the owner on Jun 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Place store configuration into a single file
- Loading branch information
June Domingo
committed
Nov 6, 2016
1 parent
fdb12c8
commit 08e107c
Showing
3 changed files
with
23 additions
and
30 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.