actionCategoriesPage.js 657 B

12345678910111213141516
  1. import { put, take } from "redux-saga/effects";
  2. import { actionFeedCats, actionFeedClear, actionPromiseClear } from "../reducers";
  3. export const actionCategoriesPage = ({ orderBy }) => ({ type: "CATEGORIES_PAGE", payload: { orderBy } });
  4. export function* categoriesPageWorker(action) {
  5. const { orderBy = "_id" } = action.payload || {};
  6. yield put(actionFeedClear());
  7. yield put(actionPromiseClear("feedCatAll"));
  8. yield put(actionPromiseClear("categoryUpsert"));
  9. yield put(actionFeedCats({ skip: 0, orderBy }));
  10. yield take("CATEGORIES_PAGE_CLEAR");
  11. yield put(actionFeedClear());
  12. yield put(actionPromiseClear("feedCatAll"));
  13. }