"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useAppSelector = exports.useAppDispatch = exports.default = void 0;
var _toolkit = require("@reduxjs/toolkit");
var _reduxSaga = _interopRequireDefault(require("redux-saga"));
var _reduxLogger = _interopRequireDefault(require("redux-logger"));
var _slices = _interopRequireDefault(require("./slices"));
var _sagas = _interopRequireDefault(require("./sagas"));
var _reactRedux = require("react-redux");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
// // --------------- LIBRARIES ---------------

// // --------------- ASSETS ---------------

// Middlewares setup
const sagaMiddleware = (0, _reduxSaga.default)();

// const middlewares = [];
// // if (__DEV__) {
// //   middlewares.push(sagaMiddleware);
// //   // middlewares.push(sagaMiddleware, logger); // With logger
// // } else {
//   middlewares.push(sagaMiddleware); // without logger
// // }

const store = (0, _toolkit.configureStore)({
  reducer: _slices.default,
  middleware: getDefaultMiddleware => getDefaultMiddleware({
    thunk: false
  }).concat(sagaMiddleware).concat(_reduxLogger.default),
  devTools: process.env.NODE_ENV !== 'production'
});

// Infer the `RootState` and `AppDispatch` types from the store itself

// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}

const useAppDispatch = exports.useAppDispatch = _reactRedux.useDispatch;
const useAppSelector = exports.useAppSelector = _reactRedux.useSelector;
// // PersistStore contains all the data from store ----->>>>>
// export const Persistor = persistStore(Store);
sagaMiddleware.run(_sagas.default); // Run Saga
var _default = exports.default = store;
//# sourceMappingURL=Store.js.map