WIP Frontend structure & authentication.

This commit is contained in:
Ahmed Bouhuolia
2020-02-17 00:15:07 +02:00
parent b3849e55e9
commit e5c78fe555
56 changed files with 3539 additions and 322 deletions

View File

@@ -0,0 +1,48 @@
import { createStore as createReduxStore, applyMiddleware, compose } from 'redux';
import thunkMiddleware from 'redux-thunk';
import monitorReducerEnhancer from 'store/enhancers/monitorReducer';
import loggerMiddleware from 'middleware/logger'
import rootReducer from 'store/reducers';
const createStore = (initialState = {}) => {
/**
|--------------------------------------------------
| Middleware Configuration
|--------------------------------------------------
*/
const middleware = [
thunkMiddleware,
loggerMiddleware,
];
/**
|--------------------------------------------------
| Store Enhancers
|--------------------------------------------------
*/
const enhancers = [
monitorReducerEnhancer,
];
let composeEnhancers = compose;
if (process.env.NODE_ENV === 'development') {
if (typeof window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ === 'function') {
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
}
}
/**
|--------------------------------------------------
| Store Instantiation and HMR Setup
|--------------------------------------------------
*/
const store = createReduxStore(
rootReducer,
initialState,
composeEnhancers(applyMiddleware(...middleware), ...enhancers)
);
store.asyncReducers = {};
return store;
};
export default createStore();