index.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { createStore, combineReducers, applyMiddleware } from "redux";
  2. import { all, put, takeEvery, takeLatest, takeLeading, select } from "redux-saga/effects";
  3. import thunk from "redux-thunk";
  4. import createSagaMiddleware from "redux-saga";
  5. import { authReducer, actionAuthLogin, actionAuthLogout } from "./authReducer";
  6. import {
  7. promiseReducer,
  8. actionPending,
  9. actionFulfilled,
  10. actionRejected,
  11. actionPromise,
  12. actionPromiseClear,
  13. promiseWatcher,
  14. } from "./promiseReducer";
  15. import { cartReducer, actionCartAdd, actionCartChange, actionCartDelete, actionCartClear } from "./cartReducer";
  16. import {
  17. actionFeedCats,
  18. actionFeedCatsFind,
  19. actionFeedGoods,
  20. actionFeedGoodsFind,
  21. actionFeedClear,
  22. actionFeedAdd,
  23. actionFeedOrdersFind,
  24. actionFeedOrders,
  25. feedReducer,
  26. actionFeedUsers,
  27. actionFeedUsersFind,
  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()]);
  57. }
  58. sagaMiddleware.run(rootSaga);