{"size": 657, "ext": "js", "max_stars_repo_path": "src/init/store.js", "max_stars_repo_name": "FeedTheOrange/garden-grower", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/init/store.js", "max_issues_repo_name": "FeedTheOrange/garden-grower", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/init/store.js", "max_forks_repo_name": "FeedTheOrange/garden-grower", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.85, "max_line_length": 79, "alphanum_fraction": 0.7260273973}
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
import createRouter from './router';
import reducers from '../reducers';

export default (preLoadedState) => {
  const {
    reducer, middleware, enhancer, thunk,
  } = createRouter;

  const composeEnhancers = (...args) => compose(...args);

  const rootReducer = combineReducers({ ...reducers, location: reducer });
  // todo apply middleware from index.jsx page
  const middlewares = applyMiddleware(middleware);
  const enhancers = composeEnhancers(enhancer, middlewares);
  const store = createStore(rootReducer, preLoadedState, enhancers);

  return { store, thunk };
};
