index.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { createStore, combineReducers, applyMiddleware } from "redux";
  2. import { all } from "redux-saga/effects";
  3. import createSagaMiddleware from "redux-saga";
  4. import { authReducer, actionAuthLogin, actionAuthLogout, authWatcher } from "./authReducer";
  5. import {
  6. promiseReducer,
  7. actionPending,
  8. actionFulfilled,
  9. actionRejected,
  10. actionPromise,
  11. actionPromiseClear,
  12. promiseWatcher,
  13. } from "./promiseReducer";
  14. import { cartReducer, actionCartAdd, actionCartChange, actionCartDelete, actionCartClear } from "./cartReducer";
  15. import {
  16. actionFeedCats,
  17. actionFeedCatsFind,
  18. actionFeedGoods,
  19. actionFeedGoodsFind,
  20. actionFeedClear,
  21. actionFeedAdd,
  22. actionFeedOrdersFind,
  23. actionFeedOrders,
  24. feedReducer,
  25. actionFeedUsers,
  26. actionFeedUsersFind,
  27. feedWatcher,
  28. } from "./feedReducer";
  29. export { cartReducer, actionCartAdd, actionCartChange, actionCartDelete, actionCartClear };
  30. export { authReducer, actionAuthLogin, actionAuthLogout };
  31. export { promiseReducer, actionPending, actionFulfilled, actionRejected, actionPromise, actionPromiseClear };
  32. export {
  33. actionFeedCats,
  34. actionFeedCatsFind,
  35. actionFeedGoods,
  36. actionFeedGoodsFind,
  37. actionFeedClear,
  38. actionFeedAdd,
  39. actionFeedOrdersFind,
  40. actionFeedOrders,
  41. actionFeedUsers,
  42. actionFeedUsersFind,
  43. feedReducer,
  44. };
  45. const sagaMiddleware = createSagaMiddleware();
  46. export const store = createStore(
  47. combineReducers({
  48. auth: authReducer,
  49. promise: promiseReducer,
  50. cart: cartReducer,
  51. feed: feedReducer,
  52. }),
  53. applyMiddleware(sagaMiddleware)
  54. );
  55. function* rootSaga() {
  56. yield all([promiseWatcher(), authWatcher(), feedWatcher()]);
  57. }
  58. sagaMiddleware.run(rootSaga);