import { applyMiddleware, compose, createStore } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunk from 'redux-thunk';
import rootReducer from './reducers';
import apiMiddleware from './middlewares/api';

const envCompose = process.env.NODE_ENV === 'production' ? compose : composeWithDevTools;
const store = createStore(rootReducer, {}, envCompose(applyMiddleware(thunk, apiMiddleware)));

export default store;
