actionPageStart.js 731 B

123456789101112131415161718192021222324
  1. import { actionAboutMe } from "./actionAboutMe";
  2. import { actionCatAll } from "./actionCatAll";
  3. import { actionGoodsPopular } from "./actionGoodsPopular";
  4. import { actionOrders } from "./actionOrders";
  5. import { actionRootCats } from "./actionRootCats";
  6. import { put, select, call } from "redux-saga/effects";
  7. import { promiseWorker } from "../reducers/promiseReducer";
  8. export const actionPageStart = () => ({ type: "PAGE_START" });
  9. export function* pageStartWorker() {
  10. yield put(actionRootCats());
  11. yield put(actionCatAll());
  12. yield put(actionGoodsPopular());
  13. const {
  14. auth: { token },
  15. } = yield select();
  16. if (token) {
  17. yield put(actionAboutMe());
  18. yield put(actionOrders());
  19. }
  20. }