actionCategoriesSearchPage.js 698 B

123456789101112131415161718
  1. import { put, take } from "redux-saga/effects";
  2. import { actionFeedCatsFind, actionFeedClear, actionPromiseClear } from "../reducers";
  3. export const actionCategoriesSearchPage = ({ orderBy = "_id", text = "" } = {}) => ({
  4. type: "CATEGORIES_SEARCH_PAGE",
  5. payload: { orderBy, text },
  6. });
  7. export function* categoriesSearchPageWorker(action) {
  8. const { orderBy = "_id", text = "" } = action.payload || {};
  9. yield put(actionFeedClear());
  10. yield put(actionPromiseClear("feedCatsFind"));
  11. yield put(actionFeedCatsFind({ text, orderBy, skip: 0 }));
  12. yield take("CATEGORIES_SEARCH_PAGE_CLEAR");
  13. yield put(actionFeedClear());
  14. yield put(actionPromiseClear("feedCatsFind"));
  15. }