import {configureStore, createReducer, getDefaultMiddleware} from 'redux-starter-kit';
import {mountReducer} from '../reducers/mount_reducer';

export default function createAppStore(platform, appPlatform) {
  const createCommonReducer = () => {
    return createReducer({
      AppPlatform: appPlatform,
      Platform: platform,
    }, {});
  };

  const reducer = {
    common: createCommonReducer(platform, appPlatform),
    mounts: mountReducer,
  };

  const middleware = [...getDefaultMiddleware()];

  return configureStore({
    reducer,
    middleware,
    devTools: process.env.NODE_ENV !== 'production'
  });
}