2016-10-19 10:55:19 +02:00
|
|
|
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
|
|
|
|
import ApolloClient from 'apollo-client';
|
2016-11-01 11:45:44 +01:00
|
|
|
import { routerMiddleware } from 'react-router-redux'
|
2016-10-19 10:55:19 +02:00
|
|
|
|
2016-10-19 10:32:24 +02:00
|
|
|
import Telescope from 'meteor/nova:lib';
|
2016-10-28 18:09:41 +02:00
|
|
|
import { client } from 'meteor/nova:base-apollo';
|
2016-10-19 10:32:24 +02:00
|
|
|
|
2016-10-19 10:55:19 +02:00
|
|
|
const rootReducer = combineReducers({...Telescope.reducers, apollo: client.reducer()});
|
2016-10-19 10:32:24 +02:00
|
|
|
|
2016-11-01 11:45:44 +01:00
|
|
|
const configureStore = (initialState = {}, history) => createStore(
|
2016-10-19 10:55:19 +02:00
|
|
|
// reducers
|
|
|
|
rootReducer,
|
2016-11-01 11:45:44 +01:00
|
|
|
//initial state
|
|
|
|
initialState,
|
2016-10-19 10:55:19 +02:00
|
|
|
// middlewares
|
|
|
|
compose(
|
2016-11-01 11:45:44 +01:00
|
|
|
applyMiddleware(client.middleware(), routerMiddleware(history)),
|
2016-10-19 10:55:19 +02:00
|
|
|
typeof window !== "undefined" && window.devToolsExtension ? window.devToolsExtension() : f => f
|
|
|
|
),
|
|
|
|
);
|
2016-10-19 10:32:24 +02:00
|
|
|
|
2016-11-01 11:45:44 +01:00
|
|
|
export { configureStore };
|