Created
August 21, 2018 11:00
-
-
Save kaleem-elahi/100e95e8eee632fc8054b6f437f44aa2 to your computer and use it in GitHub Desktop.
redux-promise-middleware
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
// This file merely configures the store for hot reloading. | |
// This boilerplate file is likely to be the same for each project that uses Redux. | |
// With Redux, the actual stores are in /reducers. | |
import promiseMiddleware from 'redux-promise-middleware'; | |
import { createStore, applyMiddleware, compose } from 'redux'; | |
import thunkMiddleware from 'redux-thunk'; | |
import rootReducer from './'; | |
const createStoreWithMiddleware = compose( | |
applyMiddleware( | |
thunkMiddleware, | |
promiseMiddleware({ promiseTypeSuffixes: ['LOADING', 'SUCCESS', 'ERROR'] }), | |
), | |
window.devToolsExtension ? window.devToolsExtension() : f => f, | |
)(createStore); | |
export default function configureStore() { | |
const store = createStoreWithMiddleware(rootReducer, { Intl: { locale: (localStorage.getItem('currentLanguage') || 'en') } }); | |
return store; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment